1. Find the file Find/-name filename.txt based on the name lookup/directory filename.txt file.
Find. -name "*.xml" recursively finds all XML files
Find. -name "*.xml" |xargs grep "Hello World" recursively finds XML file containing Hello World in all file contents
grep-h ' Spring ' *.xml find so some XML file that contains spring
Find./-size 0 | Xargs Rm-f & Delete files with a file size of zero
Ls-l | grep '. Jar ' finds all jar files in the current directory
grep ' test ' d* shows all lines that contain test in a file that begins with D.
grep ' Test ' AA bb cc shows the line matching test in the aa,bb,cc file.
grep ' [a-z]\{5\} ' AA displays all rows containing a string of at least 5 consecutive lowercase characters per string.
2. See if a program is running Ps–ef|grep Tomcat view all processes related to Tomcat
3. Terminating thread kill-9 19979 the process of terminating thread number bit 19979
4. View files, including hidden files Ls-al
5. Current working directory PWD
6. Copy file cp source dest Copy file cp-r sourcefolder targetfolder recursively copy entire folder SCP Sourecfile [email protected]:remoteaddr Remote Copy
7. Create a directory mkdir newfolder
8. Delete directory rmdir deleteemptyfolder Delete empty directory rm-rf DeleteFile recursively delete all contents in directory
9. Moving Files Mv/temp/movefile/targetfolder
10. Re-command MV Oldnamefile Newnamefile
11. Switch User Su-username
12. Modify file Permissions chmod 777 File.java//file.java permissions-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. Unzip the file 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 the log type file tail-f exmaple.log//This command will automatically display the new content, and the screen will display only 10 lines of content (can be set).
19. Use Super Administrator to execute commands sudo rm a.txt Delete files with administrator status
20. View Port Usage Netstat-tln | grep 8080 viewing usage of port 8080
21. See which program the port belongs to Lsof-i: 8080
22. View process PS Aux|grep Java view Java process PS aux view all processes
23. Listing contents in a tree view use the tree command under Ps:mac tree A
24. File download wget http://file.tgz mac install wget command Curl http://file.tgz
25. Network Detection Ping www.just-ping.com
26. telnet to SSH [email protected]
27. Print information echo $JAVA _home Print the value of the JAVA HOME environment variable
28.java Common Commands Java Javac JPS, Jstat, Jmap, Jstack
29. Other Commands svn git maven
Common Linux commands for Java development