linux Command ----CD
"Feature description"
CD: Represents the Cut directory (change directory);
"Command Syntax"
CD [options] [parameters]
"Option description"
CD or cd~: Indicates whether the current directory can be switched to the user's home directory instantaneously
Cd.. : Indicates the switch from the current directory to the previous directory, note: There are spaces behind the CD in addition.
Cd.. /.. : The table switches from the current directory to the previous level of the previous directory,
CD-: Indicates the directory or directory where you switched to the last path you were in
CD!$: Indicates that the last command parameter was called
"Parameter description"
Parameters: Indicates the target path directory such as:/ETC/RC.D/INIT.D
Add: In order to avoid the wrong operation, we should check our current location PWD when deleting files and directories.
"Instance 1"
Switch back to the user's home directory from the current directory;
[Email protected] ~]# Cd/test/testfile/testfile2
[Email protected] testfile2]# CD Testfile3/testfile3_1/testfile3_2
[Email protected] testfile3_2]# pwd
/test/testfile/testfile2/testfile3/testfile3_1/testfile3_2
[[Email protected] testfile3_2]# CD
[[email protected] ~]# switch directly back to the user home directory
"Instance 2"
Switch from the current directory to the previous level directory and switch to the top level of the previous directory
[Email protected] testfile3_2]# pwd
/test/testfile/testfile2/testfile3/testfile3_1/testfile3_2
[Email protected] testfile3_2]# CD. represents a switch from the current directory testfile3_2 to Testfile3_1
[Email protected] testfile3_1]# CD. /.. represents a switch from the current directory testfile3_1 to Testfile2
[Email protected] testfile2]#
"Instance 3"
The directory that switches from the current directory back to the previous path, typically used when two directories are switched back and forth
[Email protected] ~]# Cd/test/testfile/testfile2
[[email protected] testfile2]# ls testfile2 with two directories testfile3 and Testfile4
Testfile3 testfile4
[Email protected] testfile2]# pwd
/test/testfile/testfile2 PWD Displays the current path
[Email protected] testfile2]# CD Testfile3/testfile3_1/testfile3_2
[Email protected] testfile3_2]# pwd
/test/testfile/testfile2/testfile3/testfile3_1/testfile3_2
[[Email protected] testfile3_2]# CD- now required to testfile2 directory
/test/testfile/testfile2
[Email protected] testfile2]# CD Testfile4/testfile4_1
[Email protected] testfile4_1]# pwd
/test/testfile/testfile2/testfile4/testfile4_1
[Email protected] testfile4_1]#
Example 3 shows that "CD-" can help you when you're at work and you're going to switch back and forth between two directories, otherwise you'll have to enter a bunch of paths
CD command will always accompany us until the end, to be skilled, otherwise you will get lost.
This article is from the "Falcon" blog, please make sure to keep this source http://duying.blog.51cto.com/10484057/1674044
Linux Command-----CD