Java programmers have to learn the summary of Linux commands

Source: Internet
Author: User

1. Find Files
Find/-name filename.txt the filename.txt file under the name lookup/directory.
Find. -name "*.xml" recursively finds all XML files
2. See if a program is running
Ps–ef|grep Tomcat View all processes related to Tomcat
3. Terminating a thread
Kill-9 19979 terminating thread number bit 19979 process
pkill-9 Java Batch termination Java process
4. View files, including hidden files
Ls-al
5. Current working directory
Pwd
6. Copying Files
CP Source Dest Copy files
Cp-r sourcefolder targetfolder recursively copy entire folder
SCP sourecfile [email protected]:remoteaddr remote Copy
7. Create a directory
mkdir NewFolder
Create File: Touch test.txt
8. Deleting a directory
RmDir deleteemptyfolder Delete Empty directory rm-rf DeleteFile recursively delete all contents in directory
9. Move Files
Mv/temp/movefile/targetfolder
10. Re-order
MV Oldnamefile Newnamefile
11. Switch Users
Su-username
12. Modify File Permissions
chmod 777 File.java//file.java the permission-rwxrwxrwx,r means read, w indicates write, X is executable
13. Compressing Files
Tar-czf Test.tar.gz/test1/test2
Zip-r Test.zip/test
14. List Compressed Files
Tar-tzf test.tar.gz
15. Extracting Files
Tar-xvzf test.tar.gz
Upzip Test.zip
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, the screen displays only 10 lines of content (can be set).
19. Execute commands with Super Administrator status
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.free-m viewing memory usage and swap area usage
[Email protected] ~]# 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 Viewing the usage of each partition
[Email protected] ~]# 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 17M 1.8G 1%/run
Tmpfs 1.8G 0 1.8G 0%/sys/fs/cgroup
24.du-sh Viewing the size of a specified directory
[Email protected] ~]# 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 lets programs run in the background, often combined with &.
Tail-f. /logs/catalina.out also view the Tomcat boot log.

Java programmers have to learn the summary of Linux commands

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.