Contact UsComputer Science Department
500 College Avenue
Swarthmore, PA 19081
Email: info at cs.swarthmore.edu
Copyright 2009 Swarthmore College. All rights reserved.
the unix filesystem
The root directory (/) is the beginning or top directory for the filesystem. The Unix file system is made up of parent and sub-directories (folders). The root directory has no parent directories, but has many sub-directories, such as etc, var, bin, and home. A path to a directory consists of the directories you have to open to get to it. The absolute path consists of all the parent directories of a file or directory starting with root.
The absolute path for home in the diagram above is /home, because the root directory is home's parent directory. /home is where all the users' home directories are located. The absolute path for your home directory is:
Warning: don't confuse the / at the beginning of the path (which is the root directory) with the / separating home and yourusername (which divides the two directories).
A relative path does not start with /. It consists of the directories separating your current location in the file system from the file or directory.
If you were in /home/username and wanted to get to:
the relative path to this file would be:
There is an implicit . (called "dot") in this relative path. A single dot means the current directory, so the above relative path could also be written as:
So to look at the hello_world.py program, you could do any of the following, and they would all show you the program (using the page-by-page viewer called less):
.. (dot dot) means the parent directory (one level up). If you are in the labs directory, and then want to get to /home/username/cs21/lectures, the relative path to this file would be: ../lectures