Linux cd command
The cd command stands for “change directory”. This command is used to leave the current directory and navigate to another directory on the system.
Syntax:
Change to a New Directory
After login to the system, the user gets the home directory. Now you can navigate to another directory for example /home/rahul/Workspace where my present directory is /home/rahul
Use pwd to check your present working directory.
There are two ways to navigate between directories is the absolute path and the relative path.
The Absolute Path vs Relative Path
Absolute Path:
An absolute path is a complete path to the directory from the root directory (/). In simple terms, all the path started with a slash (/) are an absolute path. For example:
- /var
- /var/www/html
- /home/rahul/Workspace
- /backup/db/daily
You can see all the above paths are started with a slash (/).
Relativ Path:
Any path which is not started with a slash (/) is a relative path. For example:
- Documents
- www/html
- Workspace/Linux/Guides
- www/tecadmin.net/
Change Directory with Absolute Path
Changing to directory /home/rahul/Workspace with absolute directory using the cd command.
Change Directory with Relative Path
Changing to the directory Linux/Guides with a relative path using the cd command.
The cd Options
Use the below options to understand the uses of the cd command.
0 Comments
CAN FEEDBACK
Emoji