cd
(Change Directory): The cd
command in Linux is used to change the current working directory in the shell. This command allows you to navigate between directories in the file system.
Basic Usage:
cd /path/to/directory
: Changes the current directory to the specified path.cd ..
: Moves up one directory level (to the parent directory).cd ~
orcd
: Changes to the home directory of the current user.cd -
: Switches back to the previous directory you were in.
Example:
cd /var/log
- This command changes the current working directory to
/var/log
.
The cd
command is fundamental for navigating and managing the file system in a Linux environment.