The cd command in Linux is used to change the current working directory. This command is fundamental for navigating the filesystem from the command line.
cd [directory]
cd /path/to/directory
This command changes the current directory to the /path/to/directory/.
cd
or
cd ~
Both commands change the current directory to the user's home directory.
cd ..
This command changes the current directory to the parent directory.
cd -
This command switches back to the previous directory you were in.
cd ../../
cd /home/remon/projects/my_project
# Do some work
cd /etc
# Need to go back to the previous directory
cd -