1. Find Files
Find/-name filename.txt
Find the Filename.txt file under the name/directory.
2. See if a program is running
Ps–ef|grep Tomcat
See all processes related to Tomcat
3. Terminating a thread
Kill-9 19979
Thread that terminates thread number bit 19979
4. View files, including hidden files
Ls-al
5. Current working directory
Pwd
6. Copy files including their sub-files to a custom directory
Cp-r Sourcefolder TargetFolder
7. Create a Directory
mkdir NewFolder
8. Delete directory (this directory is an empty directory)
RmDir Deleteemptyfolder
9. Delete files including their sub-files
RM-RF DeleteFile
10. Move files
Mv/temp/movefile/targetfolder
Extended rename MV Oldnamefile Newnamefile
11. Switch Users
Su-username
12. Modify File Permissions
chmod 777 File.java
File.java permission-rwxrwxrwx,r means read, w indicates write, X is executable
13. Compressing files
Tar-czf Test.tar.gz/test1/test2
14. List Compressed Files
Tar-tzf test.tar.gz
15. Extracting Files
Tar-xvzf test.tar.gz
16. View file Header 10 lines
Head-n Example.txt
17. View the end of the file 10 lines
Tail-n Example.txt
18. View Log files
Tail-f Exmaple.log
This command automatically displays what's new, and the screen displays only 10 lines of content (can be set).
19. Start the VI Editor
Vi
19 Linux commands most commonly used by Java developers