Linux cd命令详解

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

cd [目录]

cd [-L|[-P [-e]] [-@]] [dir]







cd /home/user/test	此命令将改变当前工作目录到/home/user/test。
cd /root	绝对路径
cd ./home/itzhimei	相对路径
cd ../itzhimei	相对路径
cd # 在当前工作目录和上一目录切换
	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.

      -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