In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The content of this article mainly focuses on the necessary Linux commands for Java programmers. The content of the article is clear and clear. It is very suitable for beginners to learn and is worth reading. Interested friends can follow the editor to read together. I hope you can get something through this article!
Java programmers do not use the Linux system when developing, but interact with the server using shell, so java programmers should also master Linux commands.
1. Find a file
Find /-name filename.txt looks for the filename.txt file in the / directory by name.
Find. -name "* .xml" recursively finds all xml files
Find. -name "* .xml" | xargs grep "hello world" recursively finds all xml files containing hello world in their contents
Grep-H 'spring' *. Xml to find some xml files that contain spring
Find. /-size 0 | xargs rm-f & Deletes files with zero file size
Ls-l | grep '.jar' to find all jar files in the current directory
Grep 'test' d * displays lines that contain test in all files that begin with d.
Grep 'test' aa bb cc displays lines that match test in the aa,bb,cc file.
Grep'[a Murz]\ {5\}'aa displays all lines that contain at least five consecutive lowercase characters for each string.
two。 Check whether a program is running
Ps-ef | grep tomcat to view all processes related to tomcat
3. Terminating thread
Kill-9 19979 terminates a process with thread number 19979
4. View files, including hidden files
Ls-al
5. Current working directory
Pwd
6. Copy a file
Cp source dest copy Fil
Cp-r sourceFolder targetFolder recursively copies the entire folder
Scp sourecFile romoteUserName@remoteIp:remoteAddr remote copy
7. Create a directory
Mkdir newfolder
8. Delete directory
Rmdir deleteEmptyFolder delete empty directory
Rm-rf deleteFile recursively deletes everything in the directory
9. Move Fil
Mv / temp/movefile / targetFolder
10. Rename
Mv oldNameFile newNameFile
11. Switch users
Su-username
twelve。 Modify file permissions
Permissions for chmod 777 file.java file.java-rwxrwxrwx,r for read, w for write, x for executable
13. Compressed file
Tar-czf test.tar.gz / test1 / test2
14. List the compressed files
Tar-tzf test.tar.gz
15. Extract the file
Tar-xvzf test.tar.gz
16. View the first 10 lines of the file
Head-n 10 example.txt
17. View the last 10 lines of the file
Tail-n 10 example.txt
18. View log type files
Tail-f exmaple.log this command will automatically display the new content, the screen only displays 10 lines of content (configurable).
19. Execute commands using the Super Admin identity
Sudo rm a.txt uses the administrator identity to delete files
20. View port occupancy
Netstat-tln | grep 8080 to view the usage of port 8080
21. Check which program the port belongs to
Lsof-I: 8080
twenty-two。 View the process
Ps aux | grep java to view java processes
Ps aux to view all processes
23. List the contents of the directory in a tree view
Tree a
24. File download
Wget http://file.tgz
Curl http://file.tgz
25. Network detection
Ping www.just-ping.com
twenty-six。 Remote login
Ssh userName@ip
twenty-seven。 Print information
Echo $JAVA_HOME prints the value of the java home environment variable
28.java common commands
Java javac jps, jstat, jmap, jstack
What are the collection classes in Java? the sets in Java are mainly divided into four categories: 1, List list: ordered, repeatable; 2, Queue queue: ordered, repeatable; 3, Set collection: non-repeatable; 4, Map mapping: disorder, key unique, value is not unique.
Thank you for your reading. I believe you have some understanding of "what are the necessary Linux commands for Java programmers?" go ahead and practice it. If you want to know more about it, you can follow the website! The editor will continue to bring you better articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.