1. Function
The CD command is used to switch the working directory to dirname. Where dirname notation can be either an absolute path or a relative path. If the directory name is omitted, it is transformed to the user's home directory (that is, the directory where login was first). In addition, the ~ is also expressed as the meaning of home directory, which is the current directory. Represents the previous level of directory at the current directory location.
2. Grammar
CD (Options) (parameters)
3. Options
-P If the destination directory you want to switch to is a symbolic connection, switch directly to the destination directory that the symbolic connection is pointing to
-L If the destination directory that you want to switch is a symbolic connection, switch directly to the directory that the character connection name represents, not the destination directory that the symbolic connection points to.
- when only the "-" option is applied, the current working directory is switched to the directory represented by the environment variable "OLDPWD". Each time you change the directory, the Shell records the previous directory location in the environment variable OLDPWD
4, the instance CD enters the user main directory;
pwd/root
CD ~ Enter the user's home directory;
[[Email protected] ~]# CD ~pwd/~]#
CD-Returns the directory where the directory was before it entered;
pwd/~]# CD/-/pwd/root
CD: Returns the parent directory (if the current directory is "/", then "/"; "..." after execution) The meaning of the parent directory);
pwd/etc/pwd/etc
CD.. /.. Return to the top level two directory;
pwd/etc/init.d[[email protected] init.d]# CD . /pwd/
CD!$ Use the parameters of the previous command as CD parameters.
ls -ld /media/drwxr24096 /media/ /]# CD! /media/pwd/media
One Linux command per day (2): cd command