A Quick Introduction to Unix/Pathnames

pwd (print working directory)
Pathnames tell you where you are in the whole file-system. So, to find out the pathname to your home-directory, type cd ~ to get back to your home and then

% pwd

The full pathname looks something like this -

/home/nfs/fs-i/UM0098/ccaajim

which means that ccaajim (your home directory) is in the sub-directory UM0098 (the group directory),which in turn is located in the fs-i sub-directory, which is in the nfs sub-directory, which is in the top-level root directory, called / (pronounced root).

Understanding pathnames
In some Unix systems (including socrates on WTS) you will find it necessary to prefix pathnames with ~ if you want to ensure that they start from your home directory rather than the current directory or the root.

First use cd to get back to your home-directory, then type

% ls mytraining

to list the contents of your mytraining directory.

Now type

% ls archive

You will get a message like this -

archive: No such file or directory

The reason is that archive is not in your current working directory. To use a command on a file (or directory) that is not in the current working directory, you must either cd to the correct directory, or specify its full pathname. To list the contents of your archive directory you must type

% ls mytraining/archive

Since here the path is quite straightforward and relatively easy to type, using the full pathname will work reasonably well. It might be however, that the path is not so straightforward and then you will find the ~ abbreviation useful.

~ (your home directory)
Your home directory can also be referred to by the tilde ~ character. It can be used to specify paths starting at your home directory. So typing

% ls ~/mytraining

will list the contents of your mytraining directory, no matter where you currently are in the file system.

What do you think

% ls ~

would list?