Basic knowledge of system management
1. Description of basic knowledge of system management
1.1. System directory structure
1.2. The difference between an absolute path and a relative path, and when and what path to use
Absolute path: the operation starts from the root.
Relative path: the operation will be performed from the current directory
When there is a subordinate relationship between the directory you are in and the directory you are going to, use the relative path
When there is no superior-subordinate relationship between the directory you are in and the directory you are going to, use the absolute path
1.3. The function and composition of the command prompt
Function: prompt the administrator to enter the command
1.4. System syntax format
Command parameter data information
two。 System management basic command description
2.1. System operation management command
Shutdown: system shutdown / restart command
Shutdown-r h5 / (0/now): the system will restart / shut down in 5 minutes / (immediately)
Shutdown-c: the system will cancel the restart / shutdown
R:reboot: restart
H:halt: stop, stop
2.2. Directory management command
Mkdir (make directory): create a directory, but when you create a directory, be sure to make sure that the directory you create exists one level above it.
Mkdir-p: create multi-level directories
Ls (list): list view
Ls-d: view the current directory
Cd (change directory): switch directories
Cd.. Switch to the previous directory
Cd-switch to the directory where you were last located
Cd changes to the home directory of the current system user
Cd ~ switch to the home directory of the current system user
Cd.. /.. Switch the upper 2-tier directory of the current directory
Change cd / dire to the fire directory
2.4 backup of system data information copy = > cp replication command
Syntax format: cp parameter source file (backup file required) destination file (file after backup)
Backup file information
Cp / etc/hosts / etc/hosts.bak
Cp / etc/hosts / opt/
Supplement: overwrite file problem
If you copy a file normally, you will be prompted to overwrite:
[root@oldboyedu ~] # cp / etc/hosts / opt/
Cp: overwrite'/ opt/hosts'? Y
[root@oldboyedu ~] # cat / opt/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
:: 1 localhost localhost.localdomain localhost6 localhost6.localdomain6
Oldboy
How to force an override:
Method 1:\ cp oldboy01.txt / opt/-ignore the override prompt
Method 2: / usr/bin/cp oldboy01.txt / opt/-ignore the override prompt
Backup directory information
Cp-r / oldboy/ / tmp/
2.5 system data information move operation (cut) move = > mv
Syntax format: mv parameter source file (need to move file) destination path (to what path)
Move file information:
Mv oldboy01.txt / tmp/
Mobile directory information
Mv / oldboy/ / tmp/
Rename operation:
Mv oldboy/ oldgirl/
2.6 system data deletion command remove = = rm
Delete file information
Rm-f / oldboy/oldboy01.txt
Delete directory information
Rm-rf / oldboy/
-r Recursively delete the data under the directory
-f forcibly delete directory data information (no confirmation prompt)
3. File management command
3.1touch
Touch file: create file file
3.2cat
Cat file: view the content shown off in the file file
3.3echo
Echo oldboy: output oldboy information to the top of the screen
Echo oldboy > file
Cat file: check whether there is oldboy in the file file