Bash - Cd (Change Directory) builtin command

1 - About

3 - Syntax

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


If a directory change is successful through CDPATH or -, the absolute pathname of the new working directory is written to the standard output.

The return value is true if the directory was successfully changed; false otherwise.

4 - Environment variable

4.1 - HOME

The variable HOME is the default dir.

4.2 - CDPATH

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 in CDPATH is the same as the current directory, i.e., ..

If dir begins with a slash (/), then CDPATH is not used.

A colon-separated list of search paths available to the cd command, similar in function to the $PATH variable for binaries. The $CDPATH variable may be set in the local ~/.bashrc file.

bash$ cd bash-doc
bash: cd: bash-doc: No such file or directory

bash$ CDPATH=/usr/share/doc
bash$ cd bash-doc

bash$ echo $PWD

5 - Documentation / Reference

Data Science
Data Analysis
Data Science
Linear Algebra Mathematics

Powered by ComboStrap