CD Switch Directory command
1. command format
CD [option] [ directory name ]
2. Command function
Switch working directory
3. Common examples
Example 1:CD ~
Description:~ default is the home directory of the root, if the ~ after the user name, you can enter the home directory of the specified user
[Email protected] ~]#
[[Email protected] ~]# CD/
[Email protected]/]# pwd
/
Description: Enter the system root directory , after the above command to take the pwd command to see, the current directory has been to the system root directory .
[Email protected]/]# CD ~
[Email protected] ~]# pwd
/root
Description: Use CD Command Implementation Entry Root the user's home directory.
[Email protected] ~]# CD ~STU1
[Email protected] stu1]# pwd
/home/stu1
Description: Use CD command implementation into the ordinary user STU1 home directory.
Example 2: Jump to the specified directory cd/var/log
[Email protected] stu1]# cd/var/log/
[Email protected] log]# pwd
/var/log
[[email protected] log]# ls
[Email protected] log]# CD httpd
[Email protected] httpd]# pwd
/var/log/httpd
[Email protected] httpd]#
Description : Jump to the specified directory, starting at the root directory, and adding the directory name / , the subdirectory in the current directory can write the name directly; relative path: The path starting at the current position
Example 3 : CD- : Returns the directory where it was before entering this directory
[Email protected] httpd]# cd/usr/share/yum-
[Email protected] httpd]# cd/usr/share/yum-plugins/
[Email protected] yum-plugins]# CD-
/var/log/httpd
[Email protected] httpd]# CD-
/usr/share/yum-plugins
[Email protected] yum-plugins]#
Example 4: use cd!$ The parameters of the previous command as CD parameters
[Email protected] ~]# ls/var/log/
Anaconda.ifcfg.log btmp DMESG maillog-20161129 PPP Spice-vdagent.log
[Email protected] ~]# CD!$
cd/var/log/
[Email protected] log]# pwd
/var/log
[Email protected] log]#
Example 5: Return to the parent directory CD of the current directory .
[Email protected] log]# pwd
/var/log
[Email protected] log]# CD.
[Email protected] var]# pwd
/var
[Email protected] var]#
This article is from "Linux rookie" blog, please be sure to keep this source http://geekb0y.blog.51cto.com/10743719/1879771
One day a linux Base command Directory Management Class command CD