每天一个Linux命令(2):cd命令
cdcd [目录路径]示例:
1.
cd directory/这将进入名为 directory 的目录。
2.
cd ..
这将返回当前目录的上一级目录。
3.
cd这将返回用户的主目录,通常是 /home/username。
4.
cd /cd -[[email protected] ~]# cd --helpcd: cd [-L|[-P [-e]] [[email protected]]] [dir]Change the shell working directory.Change the current directory to DIR. The default DIR is the value of theHOME shell variable.The variable CDPATH defines the search path for the directory containingDIR. Alternative directory names in CDPATH are separated by a colon (:).A null directory name is the same as the current directory. If DIR beginswith 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 symboliclinks in DIR after processing instances of `..'-P use the physical directory structure without followingsymbolic links: resolve symbolic links in DIR beforeprocessing instances of `..'-e if the -P option is supplied, and the current workingdirectory cannot be determined successfully, exit witha non-zero status[email protected] on systems that support it, present a file with extendedattributes as a directory containing the file attributesThe default is to follow symbolic links, as if `-L' were specified.`..' is processed by removing the immediately previous pathname componentback to a slash or the beginning of DIR.Exit Status:Returns 0 if the directory is changed, and if $PWD is set successfully when-P is used; non-zero otherwise.