cd |
cdChange directory. Examples: cd By simply typing cd it will take you to your home directory. You could also go to your home directory by typing:
cd ~ cd /home/fred This command would take you to the directory fred located in the home directory. If you were in the /home/fred directory and knew that there was another directory in
cd /home/fred/work
or
cd work
Notice that there is no leading /.
Knowing how to change directories is critical to being able to navigate the Linux directory system. One of the reasons it is important to be able to navigate is that all commands are executed based on your preset working directory. For example, if you wanted to list the contents of the /etc directory with the command ls and your present working directory was /home/fred you would have to execute the command:
ls /etc
However, if your current working directory was /etc the command would be:
ls
Therefore it is important to clearly understand your present working directory. The pwd command aids in this because it will print the present working directory.
If you need to move up the directory tree you can use this command to move up one directory:
cd ..
For example if you are located in the /usr/share directory and then type:
cd..
You will now be located in the /usr directory, you have moved up one level.
|