Unlike Windows, the Unix File System always starts at / which is called the root of the file system.
If you are a student, your account is located in /h/[UTLN] (for example: /h/jsmith01/.
When you login to any of our Linux Labs or Linux Servers, you should start in your home directory. Please email staff@eecs.tufts.edu if you don’t start in the correct directory or have any errors when doing so.
Print Name/Path of Working Directory – pwd
To know where you are in the Filesystem use the pwd command:
vtimm0b ~/> pwd /h/vtimm0b vtimm0b ~/>
This tells you that you are in your home directory.
Listing the Contents of a Directory – ls
In order to list the files and subdirectories in my home directories, I can use the ls command:
vtimm0b ~/ > ls public_html projects personal Readme myfile.txt src vtimm0b ~/ >
It can be seen as the equivalent of “dir” in DOS.
In order to have a complete and better formatted view of your directory, you will add a few options to the ls command. The most widely-used are the following: ls -la
vtimm0a ~/> ls –la total 76 drwx------. 5 vtimm0b ceas 4096 Jun 19 12:48 . drwxr-xr-x. 3173 root root 0 May 26 11:21 .. -rw-------. 1 vtimm0b ceas 2729 Sep 11 2014 .cshrc -rwx------. 1 vtimm0b ceas 43 Jun 19 10:49 .forward drwx------. 3 vtimm0b ceas 4096 Feb 1 15:58 .gnome2 -rw-------. 1 vtimm0b ceas 362 May 23 11:49 .history drwx------. 3 vtimm0b ceas 4096 Feb 1 13:20 .local -rw-------. 1 vtimm0b ceas 2418 Sep 11 2014 .login -rw-------. 1 vtimm0b ceas 643 Sep 11 2014 .logout drwx------. 2 vtimm0b ceas 4096 Jun 19 12:48 projects drwxrwxrwx. 17 root root 4096 Jun 19 12:05 .snapshot -rw-------. 1 vtimm0b ceas 49152 May 24 08:42 .vacation.db -rwx------. 1 vtimm0b ceas 90 Jun 19 10:20 .vacation.msg
Note: In the above, the “.” is the current directory, and “..” is the directory above the current one.
Changing Directories – cd
If you want to go into (traverse) any sub-directory, you will use the “Change Directory” cd command (just like in DOS):
vtimm0b ~/> cd ./projects vtimm0b ~/.projects/
To go back one level in the file hierarchy, once again use the cd command using .. as the target directory (notice the space between the cd and the ..):
vtimm0b ~/projects/> cd .. vtimm0b ~/>
Note that if you’d like to move up or down multiple directories, you don’t need to execute multiple cd commands, simply type the full path into the command:
vtimm0b ~/>cd /projects/summer/ vtimm0b ~/projects/summer/>
A convenient shortcut to know is cd ~ or just cd without a path because it is a shortcut to your home directory.
Making a New Directory – mkdir
If you would like to make a new directory in the one that you’re currently in, use the mkdir command:
vtimm0b ~/> mkdir newDir
You can then use the ls command to make sure it was created correctly:
vtimm0b ~/> ls -la total 80 drwx------. 6 vtimm0b ceas 4096 Jun 19 12:52 . drwxr-xr-x. 3173 root root 0 May 26 11:21 .. -rw-------. 1 vtimm0b ceas 2729 Sep 11 2014 .cshrc -rwx------. 1 vtimm0b ceas 43 Jun 19 10:49 .forward drwx------. 3 vtimm0b ceas 4096 Feb 1 15:58 .gnome2 -rw-------. 1 vtimm0b ceas 362 May 23 11:49 .history drwx------. 3 vtimm0b ceas 4096 Feb 1 13:20 .local -rw-------. 1 vtimm0b ceas 2418 Sep 11 2014 .login -rw-------. 1 vtimm0b ceas 643 Sep 11 2014 .logout drwx------. 2 vtimm0b ceas 4096 Jun 19 12:52 newDir drwx------. 3 vtimm0b ceas 4096 Jun 19 12:52 projects drwxrwxrwx. 17 root root 4096 Jun 19 12:05 .snapshot -rw-------. 1 vtimm0b ceas 49152 May 24 08:42 .vacation.db -rwx------. 1 vtimm0b ceas 90 Jun 19 10:20 .vacation.msg
For information on editing files, please see the File Manipulation page.