UNIX Navigation

The basics of UNIX navigation involve the UNIX path, that is the path to describe where you are in the system. Every system is organized hierarchically, and the path describes where you are, or where you wish to access is, in terms of this hierarchical tree. The path is represented as a string of directory names separated by fore-slashes (/). The base, or root directory is at the base of the tree and is designated by a single fore-slash. Close to the root level, UNIX file systems are organized with some standard directories which represent areas which are used for different operating system purposes. For standard users the most common point of access is the /usr directory, which should contain a sub-directory called people ( /usr/people/ ). This directory houses all user home directories, so that if your username is mcdermoj, the path to your home directory will be /usr/people/mcdermoj/. When a user logs in to their account on the system, they will start out in their home directory. You should try to familiarize yourself with your system’s file system.

Navigating the file system can be accomplished with a single command, cd. Below are listed several ways that this command is commonly used, and a couple of other useful navigation commands;

cd [absolute pathname]

cd /usr/people/mcdermoj

Moves the user to the location specified by the pathname.

cd [relative pathname]

cd images

Moves the user to a subdirectory which is contained in the directory they are currently in.

cd ..

Moves the user ‘up’ one directory. For instance if it is used in the directory /usr/people/mcdermoj, it will move the user to the directory /usr/people.

cd[space-key]

Returns the user to their home directory.

pwd

Returns (prints on the next line) the path of the Present Working Directory.

ls

Returns a list of all ‘visible’ files in the directory. Generally invisible files are named with a period at the start (e.g. .login) and denote files which are used as resource files by UNIX or other programs.

ls —al

Returns a list of all of the files in the directory. The filename of each file is printed at the left, followed by information about the file to the right. Information is displayed, from left to right; permissions of the file or folder (rwxrwxrwx; first three characters are permissions for the user, then for the group, then for everyone; r for read, w for write, x for execute, see below for more information on file permissions), number of links that point to this file, user (owner) of the file, the group they belong to, size of the file in bytes, last modification time, and file name. Below is an example of what this looks like.

rw-rw-r-- 1 mcdermoj crystal 1074 July 14 16:01 test.txt