Linux命令:cd

语法

cd [-L|[-P [-e]]] [dir]
改变shell当前工作目录。仅对执行命令所在的shell有效。

 cd =change directory

进入主目录。不带参数dir,就默认进入当前用户的主目录。等价命令还有 cd ~ 或 cd $HOME。

进入上一次切换前的工作目录。cd - 或 cd $OLDPWD。如果反复执行,则会在最后两次工作目录间来回切换。

help cd

 1 cd: cd [-L|[-P [-e]]] [dir]
 2     Change the shell working directory.
 3 
 4     Change the current directory to DIR.  The default DIR is the value of the
 5     HOME shell variable.
 6 
 7     The variable CDPATH defines the search path for the directory containing
 8     DIR.  Alternative directory names in CDPATH are separated by a colon (:).
 9     A null directory name is the same as the current directory.  If DIR begins
10     with a slash (/), then CDPATH is not used.
11 
12     If the directory is not found, and the shell option `cdable_vars' is set,
13     the word is assumed to be  a variable name.  If that variable has a value,
14     its value is used for DIR.
15 
16     Options:
17         -L      force symbolic links to be followed
18         -P      use the physical directory structure without following symbolic
19         links
20         -e      if the -P option is supplied, and the current working directory
21         cannot be determined successfully, exit with a non-zero status
22 
23     The default is to follow symbolic links, as if `-L' were specified.
24 
25     Exit Status:
26     Returns 0 if the directory is changed, and if $PWD is set successfully when
27     -P is used; non-zero otherwise.

猜你喜欢

转载自www.cnblogs.com/ChinaGo/p/10634886.html
今日推荐