cd Change the current directory

Moves your shell into another folder, so that later commands work from there. It is part of the shell itself, not a separate program. With no argument it takes you to your home folder.

Synopsis

cd [-L | -P] [DIRECTORY]
cd -

Common options

Option or formWhat it does
(no argument)Go to your home folder, the one named by $HOME
-Go back to the previous directory and print its path. The shell remembers it in $OLDPWD
..Go up one level, to the parent folder. Chain them as ../.. to go up two
~Shorthand for your home folder, expanded by the shell. ~/Documents means a folder inside home
-LFollow symbolic links logically, so the path you see keeps the link name. This is the default
-PUse the physical path instead, with every symbolic link resolved to the real folder

Examples

Move into a folder
cd docs && pwd
Go up one level
cd docs/old && cd .. && pwd
Go straight to your home folder
cd && pwd
Jump back to the previous folder
cd docs && cd -
Create a nested folder and enter it
mkdir -p build/out && cd build/out && pwd
Follow a symlink to the real folder
cd -P /var/log

Notes

See also

Last reviewed 2026-10-07.