The Working Directory and pwd

NOTE: this website is under construction for the new quarter. Please pardon our dust! The content of this website is subject to change as we put together resources for the new quarter. If you are a student who took the course last quarter, you should visit last quarter's class web site instead, accessible by visiting this link.

Written by Chris Gregg, with modifications by Nick Troccoli

Click here for a walkthrough video.

Whenever you are running programs, you will have a "working directory" that represents where your program starts looking for files. This is often the directory where you launch the application from, which is not necessarily the directory where the program itself resides. To determine the directory where you are currently located, use the pwd command, as follows:

$ pwd
/afs/.ir/users/c/g/cgregg

If you change to another directory, you will have a new working directory:

$ pwd
/afs/.ir/users/c/g/cgregg
$ cd 107
$ pwd
/afs/.ir/users/c/g/cgregg/107

If you run a program and it cannot find your files, the first thing to check is the working directory.