Overview
Moving around in AFS is easy once you get a sense of how it's structured. This information can be put to good use when mounting Stanford OpenAFS on your desktop, when using Fetch or SecureFX to transfer files from your desktop into AFS, or even at the UNIX command line, where only a few basic commands can get you where you want to go.
Quick guide to AFS structure
AFS is organized into "cells". The Stanford cell is called ir.stanford.edu. When you navigate through AFS at Stanford, your location in AFS space always begins with /afs/ir.stanford.edu/. That's a lot to type, so it's usually shortened to /afs/ir/.
The /afs/ir/ directory (which is basically a giant folder) is sub-divided into 15 sub-directories. The four directories most people navigate around in are:
- /afs/ir/class/ - contains directories for courses taught at Stanford, such as chem133, psych80, and stats315a.
- /afs/ir/dept/ - contains directories for academic and administrative departments, such as the Archeology and Music departments, and the Office of the Registrar.
- /afs/ir/group/ - contains directories for non-academic groups on campus, such as the Jujitsu, Mariachi, and Wind Surfing clubs.
- /afs/ir/users/ - contains the home directories for Stanford students, staff, faculty ... everyone whose SUNet ID has qualified them for a Stanford UNIX account.
Looks like web space
This may look familiar: except for "users/", these are the same headings you see when browsing Stanford web space. It's no accident. In fact, you can usually figure out where a web page is located in AFS space by looking at its URL in the browser bar. Take away the "http://www.stanford.edu", replace it with "/afs/ir/" and you've pretty much figured out where the web page can be found in AFS space. All you have to do is guess where the WWW directory is located. (For example, the URL http://www.stanford.edu/dept/english/ means that the web page is probably at "/afs/ir/dept/english/WWW/" in AFS web space.)
Your home directory
The location of your own home directory -- the place where you store web files, images, and other sorts of computer files -- is also easy to find. Start with "/afs/ir/users/" then add the first letter of your SUNet ID, a forward slash ("/"), the second letter of your SUNet ID, a forward slash ("/"), then your SUNet ID. In other words, if your SUNet ID was "jdoe", your home directory would be in AFS space at "/afs/ir/users/j/d/jdoe/". You'll get the hang of it after you've done it for awhile. For more information about places to go in AFS, take a look at the File System Layout section of Advanced Commands,
Finding where you are
Almost all programs that connect you to AFS -- Stanford OpenAFS, Fetch, SecureFX, etc. -- will start you in your home directory. To get a sense of where this is in relation to the larger AFS structure, however, you can log into UNIX and.
- At the command line, type: "pwd" (without the quotes). The Stanford UNIX system will show you where you are. Or,
- Use the command line itself. When you first log into Stanford UNIX, the command prompt will look something like this:
cardinal:~>
But, as you start moving around in AFS, the prompt will display your location. For example, if you were to go to the English Department's home page your command prompt would look like this:cardinal:/afs/ir/dept/english/WWW>
Moving through AFS with UNIX
After logging in to UNIX, you can use the "cd" command to move from one directory to another. The "cd" actually stands for "change directory", but you can think of it as the equivalent of "go to". The other basic command, "ls", actually stands for "list" but can be thought of as "show me what's in this directory". Here's how to use the commands:
- To move forward (actually down) one directory, type:
cd <name of directory>
For example, to move from the "/afs/ir/" directory into the "user" directory you would type:cd user
- To move forward (or down) two directories, use the "cd" command plus two directories joined by a forward slash. Like this:
cd user/j/
- To move backward (or up) one directory, type:
cd ../
- To move backward (or up) two directories, type:
cd ../../
For example, the latter command would move you from the "/afs/ir/user/j/" back up to "/afs/ir/".
- To go directly to the directory you want, type "cd" plus the whole directory path. For example, if your SUNet ID were "jdoe" and you wanted to go from the Jujitsu club's directory back to your home directory you'd type:
cd /afs/ir/users/j/d/jdoe/
(There's a short cut that works only for your home directory: use the "cd" command plus the tilde. In other words, "cd ~" )
- After each "cd" command it's helpful to see what's in the directory you just entered. Type:
ls
For example, if you "cd" to "/afs/ir/user/j/" and then issue the "ls" command you might see something like:
0 2 4 6 8 a c e g i k m o q s u w y
1 3 5 7 9 b d f h j l n p r t v x z
To learn more commands useful for navigating, creating files, creating directories, and doing other things in AFS, take look at the UNIX Command Summary.