Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux cd command

Move to another directory. Use “cd -” to return to the previous one.

Shell builtin

Syntax

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

Common options

4 options
OptionWhat it does
-LFollow symbolic links and keep the logical path (default).
-PResolve symbolic links before changing directory.
-Change to the previous working directory.
--End option processing before the directory argument.

Usage examples

2 examples

Move to another directory. Use “cd -” to return to the previous one.

cd /var/log

Return to the previous working directory.

cd -

Notes

cd is a shell builtin because it must change the current shell's directory. Use cd -- '-name' for a directory whose name begins with a dash.