🐧 Linux cd Command

Change the current working shell directory to navigate through directories and folders.

Syntax

$ cd [options] [directory_path]

Common Command Options

Option Description
-LForce symbolic links to be followed (default shell behavior)
-PUse the physical directory structure without following symbolic links
-eWhen used with -P, exit with failure status if current directory cannot be resolved
@On systems that support extended attributes, browse file attributes
--Signals end of options and prevents further option processing

Practical Examples

Change to User Home Directory
cd ~
Navigates straight to the current user's home directory (e.g. /home/ubuntu).
Return to Previous Directory
cd -
Switches back to the previous directory you were working in. Handy for toggling between two paths.
Go Up One Directory Level
cd ..
Navigates to the parent directory.
Go Up Two Directory Levels
cd ../..
Navigates two folders up in the filesystem hierarchy.
Go to Root Directory
cd /
Jumps straight to the root of the entire Linux filesystem.
Navigate by Absolute Path
cd /var/www/rapidtables-online
Directly jumps to the specified absolute folder path.