As a Java programmer, online is essential work, and online is generally in the Linux environment, so know some commonly used Linux commands are still very necessary, the following is the actual work I often use the Linux command.
1. View current path
Pwd
2, view all files under the current folder
ll
3. View mount Information
Df-h
4, into a directory
CD path
5, back to the superior directory
Cd..
6, Compression
TAR-CVZF definition name. tar.gz folder
For example:
Tar-cvzf CucPayPerson20130410.tar.gz Cucpayperson
7, decompression
TAR-XVZF Compressed Package Name
8. Transfer file commands between servers
SCP file User @ip Address: path
For example:
9. Copy all the files under a folder A to another folder B
CP-RF/... /a/*/... /b/
10. Delete Folder A
RM-RF A
11. Copy A.text and rename it to B.text
CP A.text B.text
12, will a.txt renamed as B.txt
MV A.txt B.txt
13. New User
Useradd-d-weighted catalogue username
14, set the password
passwd username
15. Modify a text file
For example CucPay.log, first go to modify:
VI CucPay.log
At this point, or can not be modified, you need to press I to enter the modification, after the modification, press ESC to exit modify the interface, at this time there are two options: (1) Press: Wq Save content (2) Press: q! Force exit without saving the content.
16. View Port
Lsof-i: Port number
Or:
Netstat-an|grep Port number
17, Telnet connection test (I am generally used to measure the connectivity with a host)
Telnet IP (space) port number
Telnet 192.168.8.1 2012
You can also ping to see what routing ip
Ping IP
18, display the current user's environment variables
Env
19, view the Linux version of the method
Cat/etc/redhat-release (valid only for Redhat Linux)
Or
Lsb_release-a
20. View all Java processes
Ps-ef|grep Java
21. View a single process
Ps-aux|grep process ID (derived from above)
You can also view the process based on the process name:
Ps-ef|grep Process Name
22. Stop a process
To get the process number according to the port number:
Lsof-i: Port number
Kill Process:
Kill-9 Process ID
23. View dynamically refreshed logs
tail-200f log file (last 200 lines of dynamic trace file)
24. Execute script file
The general script file ends with. SH and is executed in the following manner:
./startup.sh (./means to execute the script file under the current path)
You can also perform in the background:
Nohup./startup.sh & (nohup means background execution)
Over