Java programmers must learn the linux Command summary, javalinux

Source: Internet
Author: User

Java programmers must learn the linux Command summary, javalinux

1. Search for files
Find/-name filename.txt find the filename.txt file under/directory by name.
Find.-name "*. xml" recursively searches for all xml files
2. check whether a program is running
Ps-ef | grep tomcat view all tomcat-related processes
3. Terminate the thread
Kill-9 19979 terminate the process with the thread number 19979
Pkill-9 terminate java processes in batches
4. view files, including hidden files
Ls-al
5. current working directory
Pwd
6. Copy an object
Cp source dest
Cp-r sourceFolder targetFolder Recursively copies the entire folder
Scp sourecFile romoteUserName @ remoteIp: remoteAddr remote copy
7. Create a directory
Mkdir newfolder
Create a file: touch test.txt
8. delete a directory
Rmdir deleteEmptyFolder Delete empty directory rm-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
Zip-r test.zip/test
14. List compressed files
Tar-tzf test.tar.gz
15. decompress the file
Tar-xvzf test.tar.gz
Upzip test.zip
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
The tail-f exmaple. log // command automatically displays the new content. The screen displays only 10 lines of content (configurable ).
19. Run the command as a super Administrator
Sudo rm a.txt deletes a file 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. free-m view memory usage and swap zone usage
[Root @ iZ2513wqj05Z ~] # Free-m
Total used free shared buffers cached
Mem: 3535 2454 1080 16 216 440
-/+ Buffers/cache: 1797 1737
Swap: 0 0 0
23. df-h to view the usage of each partition
[Root @ iZ2513wqj05Z ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/xvda1 20G 5.4G 14G 29%/
Devtmpfs 1.9G 0 1.9G 0%/dev
Tmpfs 1.8G 0 1.8G 0%/dev/shm
Tmpfs 1.8G 17 M 1.8G 1%/run
Tmpfs 1.8G 0 1.8G 0%/sys/fs/cgroup
24. view the size of the specified directory in du-sh.
[Root @ iZ2513wqj05Z ~] # Du-sh/mnt/online/
3.2G/mnt/online/
25. Start the tomcat Service
Enter the bin directory of tomcat
Nohup./startup. sh & tail-f ../logs/catalina. out
Analysis: nohup allows the program to run in the background and is often used together.
Tail-f ../logs/catalina. out and view tomcat startup logs.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.