cd [-L|-P] [dir]
Change the current directory to DIR. The variable $HOME is the default DIR. 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, i.e. .. 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, then try the word as a variable name. If that variable has a value, then cd to the value of that variable. The -P option says to use the physical directory structure instead of following symbolic links; the -L option forces symbolic links to be followed.
Reference: https://cgit.git.savannah.gnu.org/cgit/bash.git/plain/builtins/cd.def?h=bash-5.3
Supports:
cd- Change to HOME directorycd -- Change to OLDPWD (previous directory) and print itcd <dir>- Change to specified directory-L- Follow symbolic links (default unlessset -Pis active)-P- Use physical directory structure (resolve symlinks)- CDPATH - Search path for directories
- Tilde expansion (
~,~/path)
Updates environment variables:
- PWD - Current working directory
- OLDPWD - Previous working directory