This article explains basic commands for navigation within Linux file system. The diagram below represents (part of) a Linux file system know as Filesystem Hierarchy Standard. A line from one node to a node on its right indicates containment. For example, the student directory is contained within the home directory.



1. When you are working within a shell terminal, you are always operating in a particular directory. To determine which directory you are in, use the pwd command:

abraxas@abraxas-laptop:$ pwd /usr/local/bin
abraxas@abraxas-laptop:$ cd
abraxas@abraxas-laptop:$ pwd /home/student
abraxas@abraxas-laptop:$


2. Your home directory is the directory you are in when you first open the terminal. To go to your home directory from anywhere, just type "cd":

abraxas@abraxas-laptop:$ pwd
/usr/local/bin
abraxas@abraxas-laptop:$ cd
abraxas@abraxas-laptop:$ pwd
/home/student
abraxas@abraxas-laptop:$
3. An absolute path name is one beginning with the "/" character, which signifies the root of the file system tree. Therefore, another way of going to your home directory is:

abraxas@abraxas-laptop:/etc$ cd /home/student
abraxas@abraxas-laptop:$ pwd
/home/student
abraxas@abraxas-laptop:$
4. A relative path is one which starts with the name of a directory connected to the current directory. For example, if you are in the /usr directory, then typing only "cd bin" (without preceding "bin" with "/") has the following effect:

abraxas@abraxas-laptop:$ pwd
/usr
abraxas@abraxas-laptop:$ cd bin
abraxas@abraxas-laptop:$ pwd
/usr/bin
abraxas@abraxas-laptop:$
and you go to /usr/bin rather than /usr/local/bin or /bin. 5. To go to the directory containing the current working directory (also called the parent directory) type:

abraxas@abraxas-laptop:$ pwd
/usr/bin
abraxas@abraxas-laptop:$ cd ..
abraxas@abraxas-laptop:$ pwd
/usr
abraxas@abraxas-laptop:$
6. The relative pathname of the current working directory is called "." (the full stop). Therefore typing:

abraxas@abraxas-laptop:$ pwd
/usr/bin
abraxas@abraxas-laptop:$ cd .
abraxas@abraxas-laptop:$ pwd
/usr/bin
abraxas@abraxas-laptop:$
does not change the current working directory.