This article will not explain all commands in detail, but only gives common usage and explanation. For specific usage, you can use --help to view help.
1. Find files
find / -name filename.txt finds the filename.txt file under / directory by name. find . -name "*.xml" Recursively find all xml files find . -name "*.xml" |xargs grep "hello world" Recursively find all xml files containing hello world in the content of the file grep -H 'spring' *.xml Find so some xml files containing spring find ./ -size 0 | xargs rm -f & Delete files with zero file size ls -l | grep 'jar' Find all jar files in the current directory grep 'test' d* Show all lines containing test in all files starting with d. grep 'test' aa bb cc displays the line matching test in aa, bb, cc files. grep '[az]/{5/}' aa Displays all lines of strings containing at least 5 consecutive lowercase characters per string.2. Check whether a program is running
ps ef|grep tomcat View all processes about tomcat
3. Terminate the thread
kill -9 19979 Thread with thread number 19979
4. View files, including hidden files
ls -al
5. Current working directory pwd
6. Copy the file
cp sourceFolder targetFolderscp sourcecFile remoteUserName@remoteIp:remoteAddr Remote copy
7. Create directory mkdir newfolder
8. Delete the directory
rmdir deleteEmptyFolder delete empty directory rm -rf deleteFile recursively delete everything in the directory
9. Move files
mv /temp/movefile /targetFolder
10. Re-command
mv oldNameFile newNameFile
11. Switch users
su -username
12. Modify file permissions
chmod 777 file.java // permissions of file.java - rwxrwxrwx, r means read, w means write, and x means executable
13. Compress files
tar -czf test.tar.gz /test1 /test2
14. List the list of compressed files
tar -tzf test.tar.gz
15. Unzip the file
tar -xvzf test.tar.gz
16. View the file header 10 lines
head -n 10 example.txt
17. View the end of the file 10 lines
tail -n 10 example.txt
18. View log type file
tail -f example.log //This command will automatically display new content, and the screen only displays 10 lines of content (can be set).
19. Execute commands using the super administrator
sudo rm a.txt Delete files using administrator
20. Check port occupancy
netstat -tln | grep 8080 Check the usage of port 8080
I hope you can master the above 20 commands and hope it will be helpful for you to develop Java