Unix Filesystem Basics - Directories

The Unix filesystem is a hierarchical structure generally organized like a pyramid, as in the following example:



Directories

      Each of the above headings is either a directory or a file. A directory may contain files and/or more directories. The highest level of the filesystem tree is called the root directory and is symbolized by the slash " / ".

      A directory or file is identified by its location or pathname. In the above diagram, the absolute pathname to the home directory ellen would be :

/homes/e/el/ell/ellen


Current Directory

      To find out what directory you are currently located in type the command pwd. The computer will display your absolute path. You need pathnames to change directories, copy files, and add more files.


** Note: When executing the pwd command, users may notice an unusual prefix to their path. For example, from your home directory, the pwd command may output: /tmp_mnt/homes/sunserv1/stdt/joeuser The /tmp_mnt should be ignored. It is used as part of the NFS (Network File System) Automounter. When referencing files or directories, do not include the /tmp_mnt .



Changing Directories

      To change directories, you type cd and the pathname of where you are going. For example:

cd /usr/local/bin


      To return to your home directory, type cd without any arguments. To insure that you are home, type pwd. You do not always have to use absolute pathnames to change directories. Some shortcuts are:
cd / sends to root directory
cd /directory sends to directory below root
cd .. sends to directory immediately above
cd ../.. sends two directories up


For more information on UNIX Basics one can look at:

Back to the table of contents