First, let's explain the general structure of RedHat Linux directory structure:
1: basic commands
(1) ctrl+win+d: display the desktop (this is the shortcut)
Ctrl+alt+T: Quickly open a terminal
Ctrl+shift+T: Create a terminal and display it in a browser-like manner, and use alt+number to display the terminal interface corresponding to the number; ctrl+shift+D: close the terminal
(2) ctrl+C: the command is not executed
(3) ls: display all files and folders in the current directory
(4) ls xxxx: Display all files and folders under xxx (such as showing all files and folders under the root directory ls /)
(5) ls -a : display hidden files and non-hidden files in the current directory
(6) ls -l: display the contents of the current directory in the form of a list
(7) ls -l -h : display the total file capacity in the current directory
(8) ls x*: Display files starting with x in the current directory (such as ls 2*, so only files starting with 2 will be displayed)
(9)clear: clear the contents of the current terminal screen (simple point is to clear the screen)
(10) pwd: view the current path
(11) cd xxxx: enter a xxx directory
(12)cd .. (two points): return to the previous directory
(13)cd ../.. : Returns the first two levels of the current directory. Note that this is not directly written four. But need to be separated by "/"
(14)cd - (minus sign): Quickly return to the directory of the last entered path
(15)cd ~ (wavy line): return to the current user's directory
(16) touch xxx: create a xxx file
(17)touch .xxx: Create a hidden file (Note: there is a dot in front of the file name, which is different from the above)
(18)mkdir xxxx: create a xxx folder
(19) rm xxx: delete xxx files or folders
Rm xxx -r : Delete folders and files, which can be deleted regardless of whether the folder has content. The previous rm command must ensure that there is no content to delete.
Rmdir xxx: delete folder (only delete folder)
(20)xxx --help : View the usage documentation of the xxx command
(21) man xxx : View the usage documentation of the xxx command
(22) gedit xxx : Open and be able to edit xxx files (such as gedit 123.txt)
(23) cat xxx: directly display the contents of the xxx file in the terminal (such as cat 123.txt, directly display the contents of txt at once)
(24)more xxx: Display the contents of the xxx file, but it is not a one-time display. This is the difference from the cat command. It is generally used in the display of large files. (spaces can turn pages down)
(25) history: Display the history command content that has been operated before. When the command is displayed, you can also use the command! a number so that the content of the corresponding command in the display can be directly executed
(26) ls >xxx.txt: Redirection, which is equivalent to the content that ls should be displayed in the terminal, displayed in the xxx.txt file, the content inside is the content displayed by the terminal itself (will be xxx.txt before) The contents of the file are cleared first and then the current new content is added)
(27) ls >>xxx.txt: Redirection, the difference between this and the above is that this will append the new content to the file (the contents of the previous xxx.txt file will not be emptied).
(28)tree : displays all files and folders in the current directory in the form of a tree
(29) mkdir A / B / C / D / E -p : This similar command is mainly used to create, for example, want to create a folder in a folder below the folder below the folder, But the previous ones are not created. If you create them one by one, it is more troublesome. If you create them by adding a -p, you will create the default folders by default. You can compare the results with -p and no -p.
(30) mv xxx1 xxx2: Rename, where the first parameter xxx1 is the file or folder to be renamed, and the second parameter xxx2 is the name to be modified. If xxx2 is the content already existing in the current directory, Will cut the contents of xxx1 into xxx2, the function at this time is equivalent to cutting, otherwise it is the function of renaming.
(31) ln -s xxx1 xxx2: xxx1 create a shortcut to a file or folder (that is, a copy of meaning, that soft link), when the original file is deleted, the shortcut will be deleted and can not be use
Ln xxx1 xxx2: Create a shortcut for the xxx1 file or folder (also a copy, but a hard link). When the original file is deleted, this shortcut can still be used. This is the difference from the soft link.
(32)grep "xxx" yyy: Search for the yyy file, which contains the xxx content file, which is to implement the search function.
grep -n "xxx" yyy: the number of rows found to meet the content display
Grep "^xxx" yyy: Find content that must start with xxx (mainly the role of the ^ symbol, used in regular expressions)
Grep "xxx$" yyy : Find content that must end with xxx (mainly the effect of the ¥ symbol, which is used in regular matches)
(33) cp xxx .txt yyy: copy and paste xxx. The txt file into yyy must ensure that yyy is already in the current directory. If you copy and paste a folder into another folder, you need to use the command to change: cp xxx yyy -r
(34) Prompt without permission, then add sudo
(35) find xxx -name "yyy": is also a search command, xxx indicates the directory to be searched, can be current or root directory, -name indicates search by name (also can be -size , this is to search by file size, you can also search by permission: -perm), yyy means the content of the name in the search (if you search by size, fill in the file size here, such as 2M, 2k, +2M (greater than 2M), -2M (less than 2M) can be; if you search by permission, then fill in the size of the permissions, such as 777, 666, etc.). .
(36) tar -cvf xxx.tar yyy: package yyy files (yyy can be multiple, not necessarily only one) to become a compressed file named xxx, such as tar -cvf yasuo *.txt, so the current directory The files ending with txt are packaged into a tarball called yasuo, but this is not compressed.
(37) tar -xvf yasuo.tar: unpacking, which is the reverse process of packaging
(38) tar -zcvf xxx.tar.gz yyy: This is packaged and compressed (to master), this compressed minimum capacity
Tar -jcvf xxx.tar.bz2 yyy: This is also compression, but the form of compression is not the same (to master), the capacity of the compressed second
Zip xxx.zip yyy : This is also the way to compress (master), the compressed capacity is larger than the previous two
Tar -zxvf xxx.tar.gz : Unzip the package (to master)
Tar -jxvf xxx.tar.bz2: Unzip the package (to master)
Unzip xxx.zip: unzip the package (to master)
(39)which xxx: View the path of the xxx command, such as which ls, is to view the path where the ls command is located.
(40) cal: view the current calendar
Date: view the current time
Date "+%Y------%m-----------%d": display the date of the year, month and day in a custom format
(41) ps -aux: view the current process of ubuntu
Top: display the current process, dynamic change display
Htop: also shows the current process, more visual display
Kill -9 process number: mandatory (the role of -9) kills the process of the corresponding process number
(42) reboot: restart the computer immediately
Shutdown -r now: Shut down immediately
Shutdown -h now: Shut down immediately
Init 0: shutdown
Init 6 : restart
(43) df: display the use of the hard disk
Du: display the current directory usage
Ifconfig: check the status of the network card