Linux cd命令详解

Linux cd命令用于改变当前工作目录,即进入指定的目录。

语法:
cd [目录]

命令格式:
cd [-L|[-P [-e]] [-@]] [dir]

参数:
-L:使用符号链接替换路径名。

-P:使用实际路径名替换路径名。

-e:如果指定的目录不存在,则退出shell。

-h:显示帮助信息。

-q:不显示任何信息。

例子:

cd /home/user/test	此命令将改变当前工作目录到/home/user/test。
cd /root	绝对路径
cd ./home/itzhimei	相对路径
cd ../itzhimei	相对路径
cd # 在当前工作目录和上一目录切换
DESCRIPTION	 
	Change the shell working directory.

    Change the current directory to DIR.  The default DIR is the value of the
    HOME shell variable.

    The variable CDPATH defines the search path for the directory containing
    DIR.  Alternative directory names in CDPATH are separated by a colon (:).
    A null directory name is the same as the current directory.  If DIR begins
    with a slash (/), then CDPATH is not used.

    If the directory is not found, and the shell option `cdable_vars' is set,
    the word is assumed to be  a variable name.  If that variable has a value,
    its value is used for DIR.

    Options:
      -L        force symbolic links to be followed: resolve symbolic
                links in DIR after processing instances of `..'
      -P        use the physical directory structure without following
                symbolic links: resolve symbolic links in DIR before
                processing instances of `..'
      -e        if the -P option is supplied, and the current working
                directory cannot be determined successfully, exit with
                a non-zero status
      -@        on systems that support it, present a file with extended
                attributes as a directory containing the file attributes