To move to a new directory in Linux, you use the cd (change directory) command. Here’s how to do it:
Syntax:
cd /path/to/new_directory
Steps:
- Open Terminal: Launch your terminal application.
- Use the
cdCommand: Type thecdcommand followed by the path to the new directory you want to move to.
Example:
If you want to move to a directory called projects located in your home directory, you would use:
cd ~/projects
Or, if the directory is in a different location, specify the full path:
cd /home/user/documents/projects
Important Notes:
- Use
cd ..to move up one directory level. - Use
cd ~to return to your home directory. - You can use
pwdto print the current working directory and confirm your location.
If the directory does not exist, you will receive an error message. Make sure to create the directory first using mkdir if needed.
