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.
Grammar
CD (options) (parameters)
Options
-P If the destination directory that you want to switch to is a symbolic connection, switch directly to the destination directory where the symbolic connection is directed to-L if the destination directory that you want to switch to 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".
Instance
The CD enters the user's home directory;
CD ~ Enter the user's home directory;
CD-Returns the directory where the directory was before it entered;
Cd.. Return to the parent directory (if the current directory is "/", then "/"; "..." after execution) The meaning of the parent directory);
Cd.. /.. Return to the top level two directory;
CD!$ Use the parameters of the previous command as CD parameters.
Linux CD command