$linuxjunkies
>

cd(1)

Change the current working directory in the shell.

UbuntuDebianFedoraArch

Synopsis

cd [DIRECTORY]

Description

cd changes the current working directory to the specified directory. If no directory is given, it changes to the home directory. It is a shell built-in command, not an external program.

The directory argument can be an absolute path (starting with /), a relative path (relative to the current directory), or a special reference like .. (parent directory) or ~ (home directory).

Common options

FlagWhat it does
-PResolve symbolic links before changing directory (physical directory)
-LKeep symbolic links as-is without resolving them (logical directory)

Examples

Change to the absolute path /home/user/documents

cd /home/user/documents

Move up one directory level to the parent directory

cd ..

Change to the current user's home directory

cd ~

Change to the home directory (same as cd ~)

cd

Change to the previous directory you were in

cd -

Change to a subdirectory relative to the current location

cd ./subfolder

Related commands