Linux Command notes (1), linux Command notes
1. ls: view files in the current folder 2. ls-a: View hidden files in the current folder 3. ls-l: view files in the current folder in the form of a list 4, ls-h: view the files in the current folder and convert the file size to 5. supported formats include ls-ahl and ls-lha.Add: ls/bin to view the content in the/bin directory. This command can still be executed without the need to be in the bin directory.
6. cd jump to directory 7, absolute path: path 8 starting with directory, relative path: path starting with current folder
9. tree displays the directory format 10 in the current path as a tree chart. tree-alh supports parameters.
11. touch creates a file 12, mkdir creates a directory 13, rmdir deletes an empty directory, non-empty directory cannot be deleted 14, rm deletes a fileSupplement: mkdir-p creates A directory under the directory, for example, mkdir-p A/B/C/D. If you do not have ABC,-p automatically creates A directory for you. Addition: rm-r can be recursively deleted to delete files or folders, regardless of whether there are any files in the folder.
15. view the current path on pwd: 16. view the current user on users.
17, cd... jump to the upper-level directory 18, cd... jump to the upper-level directory and so onSupplement: cd-jump to the last Directory, which is similar to the returned directory, but only recorded once
19, ls 1 * view all files starting with 1 in the current directory 20, ls 1? View All files starting with 1 with 2 digitsSupplement: ls 1 [1-5] 3 view files 113-153, [] and? Similar, station position
21. history command
22, ls> 123 redirect the ls display to file 123 23, ls> 123 Add the ls display to file 123
Tip: After a single> Redirection symbol is redirected to a file, the content before the file is deleted and cannot be retrieved.
24. Run cat to view the file and directly flip to the bottom 25 of the file. view the file more.Supplement: cat 1.txt 2.txt> 3.txt: Use cat to merge files 1 and 2 into three files.
26. Pipe: | the output of one command is used as the input of another command 27. clear the screen: clear the current screen text. You can also press ctrl + l.
28, mv 1.txt 2.txt: Rename.Supplement: mv 1.txtName/: Cut and paste the 1.txt file to the name folder. Supplement: mvName/Names: Rename the directory name as names
29, ln 1.txt 2.txt: Create a hard link for the 1.txt file, 2.txt 30, ln-s 1.txt 2.txt: create a soft link for the 1.txt file, 2.txt
31. grep "abc" 1.txt: Find data that contains abc in file 1.txt 32, grep "^ abc" 1.txt: Search for data starting with abc in file 1.txt 33, grep "abc $" 1.txt: search for data ended with abc in file 1.txt
34, cp 1.txt name/: copy the file to the directory 35, cp name/names-r: copy the file to the directory
36, find/bin-name "1": find the bin directory, containing the file name 37, find/bin-size 1 M: find the bin directory, file 38 equal to 1 MB, find/bin-size + 1 M: find file 39 greater than 1 MB, find/bin-size-1 M: find file under bin directory, files smaller than 1 MBSupplement: It seems that the parameter is incorrect.
40, tar-cvf wait.tar *. txt: Pack all txt files to 41, tar-xcf wait.tar: unpack the wait.tar File
42, tar-zcvf wait.gz *. txt: compress the txt file. The file name is wait.gz file 43, tar-zxcf wait.gz: DecompressSupplement: Add-C to specify the path.
44, tar-jcvf wait.bz2 *. txt: Compressed 45, tar-jxcf wait.bz2: Decompress
46, ps-aux: view all processes 47, top: display all processes 48 in real time, kill-9 6520: Force kill processes with PID 6520Supplement: there is also a relatively hanging htop, which can also be viewed by the Process
49. reboot: restart the computer
50, df-h: computer hard disk usage 51, du-h: View hard disk usage in the current directory
52. ifconfig: view the network IP address and network condition 53. sudo ifconfig ens33 172.1692.2: Set the IP address
54. useradd wait-m: create a user whose username is wait 55, su wait: Switch to wait user 56, sudo passwd wait: reset the password of the wait user
57, ssh wait@168.192.1.1: Remote Login ip is 168.192.1.1 wait user 58, who: view how many users are currently logged on 59, userdel: delete user 60, sudo-s: Temporary switch root User