Linux common commands
1. View directories and files: Is In ls-la: display the detailed information of all files in the current directory.
2. Switch directories: cd hcd/home enters the' /home' directory in the cd ... and returns to the previous directory in the cd and the first two directories hn.
3. Display the current directory.
4. Create an empty file: touch In touch desc.txt: Create the file desc.txt in the current directory.
5. Create a directory: mnkdirlarnkdir test: create a monthly record of test in mkdir-p/opt/test/img under the current directory: create a directory IG under the /opt/test directory; If there is no test directory, first create a test directory in.
6. View file contents: cat nc at desc.txt: View the contents of desc.txt in the sent ser.
7. Page view file content: more contents of page view desc. txt in lar ore desc.txt:ecol te:a it.
8. Check the contents at the end of the file: Tailintail-100desc.txt: the last100 line of desc.txt is1.m.
9.copy:cpIncpdesc.txt/mnt/: fishing for desc.txt to CP-rtest /mnt in the/mnt directory; Copy the test directory to n10 under the /mnt directory; Cut or Rename: nmvdesc.txt/mnt/: cuts files.
Desc.txt to the directory /mnt. The original name in mv is the new name N, which is highly portable.
1 1. Delete: rm in rm-rf test: Delete test record, and delete recursively.
In addition, an f is forcibly deleted. Dangerous operation, be careful, prick! n
12. Search file: find it in find/opt-name*. Txt': Find the file ending with to open. Txt in opt directory.
13. display or configure the network device: ifconfig ln ifconfig: display the status h of the network device.
14, displaying network related information: netstat-a in netstat: list all ports n netstat-tun Ip/grep Swiss slogan: check the process sending port number n.
15.Show process status:PSL NPS-ef:Show all current processes a it laps-e fgrep Java:Show all current Java-In psaux:View processes In。
16, check directory usage: du ln du-h/opt/test: check disk usage of /opt/test directory 1n machine learning.
17, check the usage of disk space: df ndf-h: check the usage of disk space in web development.
18. Display system current process information: top In top: display system current process information 1.
19. Kill process: kill l kill-9278 10. Kill the process with the process number of 278 10, forcibly terminate, and the system resources cannot be recovered. 1n 20, compression and decompression: tarin tar-z cvf test.tar.gz./test package the test directory as a test.tar.gz file. A z means compressing Intar-zxvf test.tar.gz with q zip: decompressing test.tar.gz files in sent.
2 1, change the owner of the file or directory, and
Group: chownlchownnginx: nginxdesc. txt: the owner of the change file desc.txt is (68henginx, and the user group is.
Nginxichouwn-r ng in x: nginxtest: change the owner of all files in the test and directory to ng in x, and change the at user group to ng in x.
22. Change the access rights of a file or directory.
Limit: chro dich modu tx test.sh: scope of authority: u (owner) g (county group). (Other users) Permission code: I (Read permission
Limit /4)W (write permission /2x (execute permission/1# to file owner)
Increase the execution authority of test.sh n chmod u+x-R test: increase the execution authority of the test directory and all files under it for the file owner.
23. Text editing: vim has three modes: command mode, insert mode and edit mode. Use ESC or I or: to switch modes.
Type. In the mouth command mode; G exit: q! Forced exit: wa! Save and exit: set number displays line number f java, find Java YY copy p paste in vimdesc.txt: editdesc.txt file In 24, shutdown or restart: shutdown In shutdown-h now: stand.
Shut it down within shutdown-t-t60: 60 seconds, and then restart it.
N shutdown-l now: restart (1) in reboot: restart (②) in sent m 25, help command: maniman 1s: view the help document n help ln (name ke 26, view 10.
Check directly (yuminstall io top installation) for a relatively high disk reader.
27. Check the port number occupation: 1s of-iln.
28. Check and report the running time and average load of the system: normal running time?
29, commonly used shortcut keys in Ctrl+a cursor to the beginning in Ctrl+TC interrupt the current program in Ctrl+d or the cursor currently used in Ctrl+te to the end in CTRL+ 1 Clearing the screen is equivalent to in Ctrl+u d lear cut, delete (before the cursor) content -Ctrl tk cut, delete (after the cursor
) content -Ctrl+R find (recently used command) n tab all paths and finish command ntctrl t shift+c command line copy content.
Paste the contents in the command line of Ctrl tsh i it+v Cancel screen locking in Ctrl+g and perform screen locking in Ctrl+s 1.
Important commands in 30.l, top: View the current process information of the memory/display system n 2, df-h: View the storage status of the disk n 3, io top: View the yum install io top installation) n 4, io top-0: Directly view the relatively high disk read-write program in 5.netstat-tun lp? Saint Graepp
Advertising slogans involved: Check the port number occupation (1)In6, I port number of Is: Check the port number occupation (2) 1n 7, Overuptime: Check and report the system running time and average load n8, Psaux: e check progress.