One, Absolute path
is starting from the root, such as:/root,/usr/local.
Second, relative path
Relative to the current path, for example, we have established a a.txt under the current path.
[[Email protected] ~]# pwd/Root[[email protected]~]# ls1. cap -. txt application iptables.bak oneinstack shellscripts1. IPT a.php Document.pdf npm-debug.log Ruanwenwu syncwithgit.sh[[email protected]~]# Touch A.txt[[email protected]~]# ls1. cap -. txt application document.pdf npm-debug.log Ruanwenwu syncwithgit.sh1. IPT a.php a.txt Iptables.bak oneinstack shellscripts[[email protected]~]#
Third, CD command
The CD command means change directory, that is, changing directories.
[Email protected] ~]# pwd/~]# cd ruanwenwu/[[email protected] ruanwenwu]# pwd/root/
Several common parameters of the CD command:
Switch to the previous level directory:
[email protected] ruanwenwu]# pwd/root/~]# pwd/
Switch Home Directory
[Email protected] ~]# cd/data/[[email protected] data]# pwd/~~]# pwd/root
Switch to the previous directory (similar to the remote Control change station)
[Email protected] ~]# pwd/~]# cd/data/[[email protected] data]# pwd/~ ~ ]# pwd/root
Iv. mkdir
The mkdir command is used to create the directory.
Create a directory:
[[email protected] ~]# mkdir 1[[email protected] ~]# LS1 1.ipt a.php a.txt iptables.bak Oneinstack shellscripts1.cap 33.txt application document.pdf npm-debug.log Ruanwenwu syncwithgit.sh
Create a time-to-default permission
[Email protected] ~]# mkdir-m777 2[[Email protected]~]# LS-Lttotal1920x1080drwxrwxrwx2Root root4096Oct - xx: to 2drwxr-xr-x2Root root4096Oct - xx:Geneva 1-rw-r--r--1Root root0Oct at at: -A.TXTDRWXR-xr-x5Root root4096Sep One A: -APPLICATIONDRWXR-xr-x3Root root4096Apr - -: Oneshellscripts-rwxr-xr-x1Root root599AprTen .syncwithgit.sh-rw-r--r--1Root root8242Mar - .npm-Debug.log-rw-r--r--1Root root0Mar - . -. txt-rw-r--r--1Root root $MarTen .a.php-rw-r--r--1Root root296Mar1 .Iptables.bak-rw-r--r--1Root root0Mar1 . 1. IPT-rw-r--r--1Tcpdump tcpdump -Mar1 . 1. capdrwxrwxrwx2Root root4096Nov5 .RUANWENWUDRWXR-xr-x7Root root4096Feb + .Oneinstack-rw-r--r--1Root root1909424Feb + .Document.pdf
As you can see, the permissions for the 2 directories and 1 directories Given the default permissions are not the same. The default 1 permission is 755.
To create a directory continuously:
[Email protected] ~]# mkdir3/4/5mkdir:cannot Create directory '3/4/5': No such file or Directory[[email protected]~]# mkdir-p3/4/5[[Email protected]~]# ls1 1. IPT3a.php a.txt iptables.bak oneinstack shellscripts1. cap2 -. txt application document.pdf npm-debug.log Ruanwenwu syncwithgit.sh[[email protected]~]# Tree3-Bash:tree:command not found[[email protected]~]# Yum install tree[[email protected]~]# Tree33└──4└──5
As you can see, without the P parameter, it cannot be created consecutively.
Wu, RmDir
The purpose of rmdir is to remove the directory. His function is more chicken, it can only delete empty directory.
Remove empty directory 5:
3/4/5334
Create the file under 4 and then try to delete the 4:
3/4/3/4rmdir:failed to remove '3/4 ': Directory not empty
RmDir has a P parameter that can delete multiple directories consecutively, corresponding to the P parameter of mkdir, but can only delete empty directories:
3/4rmdir:failed to remove '3/4': Directory not empty
Delete the Aa.txt in the 4 directory and try again:
3/4/aa.txt rm:remove Regular empty file '3/4/aa.txt '? 3/433 [Error opening dir]00 files
Six, RM command
The RM command is used to delete files and directories.
In the example above we have seen that the system will give you a hint when the RM does not add any parameters. If the plus f parameter is not:
33/3/a.txtrm:remove regular empty file '3/a.txt '? 3
So what is the RM delete directory?
3/3rm:cannot Remove '3': is a directory
It appears that RM cannot delete the directory directly, but with the R parameter, it can:
3 rm:cannot Remove ' 3 333: No such file or directory
Linux Learning (vi) absolute path, relative path, CD, mkdir, RmDir, RM