Linux commands required by Java developers
Provided by Beijing shangxuetang
This article does not explain all commands in detail, but only provides common usage and explanations. You can use--help
View help or use google search to learn.
1. Search for files
find / -name filename.txt
Find the filename.txt file under/directory by name.
find . -name "*.xml"
Recursively search all xml files
find . -name "*.xml" |xargs grep "hello world"
Recursively search for xml files containing hello world in all files
grep -H 'spring' *.xml
Search for xml files containing spring.
find ./ -size 0 | xargs rm -f &
Delete an object of zero size
ls -l | grep 'jar'
Find all jar files in the current directory
grep 'test' d*
Display all the lines containing test in files starting with d.
grep 'test' aa bb cc
The row Matching test is displayed in the aa, bb, and cc files.
grep '[a-z]\{5\}' aa
Display All rows of a string that contains at least five consecutive lowercase characters.
2. check whether a program is running
ps –ef|grep tomcat
View All tomcat Processes
3. Terminate the thread
kill -9 19979
Terminate the thread with the thread number 19979
4. view files, including hidden files
ls -al
5. current working directory
pwd
6. Copy an object
cp source dest
Copy a file
cp -r sourceFolder targetFolder
Recursively copy the entire folder
scp sourecFile romoteUserName@remoteIp:remoteAddr
Remote copy
7. Create a directory
mkdir newfolder
8. delete a directory
rmdir deleteEmptyFolder
Delete empty directoryrm -rf deleteFile
Recursively delete all contents in the directory
9. Move files
mv /temp/movefile /targetFolder
10. Heavy command
mv oldNameFile newNameFile
11. Switch users
su -username
12. Modify file permissions
chmod 777 file.java
// File. java permission-rwxrwxrwx, r indicates read, w indicates write, and x indicates executable
13. compressed file
tar -czf test.tar.gz /test1 /test2
14. List compressed files
tar -tzf test.tar.gz
15. decompress the file
tar -xvzf test.tar.gz
16. view the first 10 lines of the file
head -n 10 example.txt
17. View 10 lines at the end of the file
tail -n 10 example.txt
18. view log files
tail -f exmaple.log
// This command will automatically display the new content. The screen will display only 10 lines of content (configurable ).
19. Run the command as a super Administrator
sudo rm a.txt
Delete an object as an administrator
20. view port usage
netstat -tln | grep 8080
View port 8080 usage
21. Check which program the port belongs.
lsof -i :8080
22. view the process
ps aux|grep java
View java Processes
ps aux
View all processes
23. list the contents of a directory in a tree chart
tree a
Ps: Use the tree Command in Mac
24. File Download
wget http://file.tgz
Install the wget command on mac
curl http://file.tgz
25. network detection
ping www.taobao.com
26. Remote Logon
ssh userName@ip
27. Print Information
echo $JAVA_HOME
Print the value of the java home environment variable
28. Common java commands
Java javac jps, jstat, jmap, jstack
29. Other commands
Svn git maven
28. linux Command Learning Website:
Http://explainshell.com/
References:
Troubleshooting of Linux port occupation (Error: JBoss port is in use. Please check)
Powerful and Common commands in linux: find and grep
Linux commands
Please add it !~
Beijing shangxuetao-cctv.com advertising partners, professional java training institutions, best-of-mouth java training, iOS training, android training, hadoop big data training, web Front-end, 0 Yuan admission, payment after employment, with an average employment salary of more than 9500