Aliases and Symbolic Links: Two Ways to Create Web Directory Shortcuts

Why Web Directory Shortcuts are Useful

AFS is an undeniably powerful tool for campus webmasters. However, AFS long directory paths can be awkward and cumbersome to use -- especially if you're juggling one or more large departmental websites. Whether you're directly editing HTML documents from OIT's gl.umbc.edu Unix servers, or creating webpages from your personal PC and uploading the results to the appropriate webspace using SCP, you will need to traverse the far-flung limbs of UMBC's AFS tree and locate the correct directories.

For example, I currently edit numerous UMBC websites that require that I periodically jump between different AFS regions. This webpage (when completed) will be placed in a web directory housing OIT's Web Development guides, which share the main URL of www.umbc.edu/oit/webdev/). The corresponding AFS path for these documents is /afs/umbc.edu/public/www/oit/webdev/. Other draft documents I've been editing are warehoused within my personal account's public webspace, which originate from the /afs/umbc.edu/users/v/e/vergil/pub/www/ AFS path.

Thankfully, I can use two sorts of Unix shortcuts that will immediately place me in the AFS directories I wish to work from, instead of having to use the Unix cd (change directory) command and correctly type out the lengthy path to my destination directory. These two kinds of time-saving shortcuts are known as aliases and symbolic links. Both types of shortcuts must be created from the Unix command line of a gl.umbc.edu server.

Using Unix Aliases to Speed Your Way Through AFS

Unix aliases are quite simple in function: each alias you create allows you to substitute a lengthy, difficult to remember command for a single, short word or string. Aliases are quite convenient in situations where you find yourself repetitively typing the same complex commands or arguments, and wish to save time by invoking such commands with a brief abbreviation. If I tired of having to type cd /afs/umbc.edu/public/www/oit/webdev/ every time I wanted to move into OIT's Web Development directory, I could create an alias so the word webdev would accomplish the same task. The text of this alias would look like this:
alias webdev "cd /afs/umbc.edu/public/www/oit/webdev/". Actually creating Unix aliases is a several step process, described in detail below.

  • Using SSH, log into a gl.umbc.edu Unix server.
  • Once you've logged in, you'll be in your home directory by default. From your home directory, locate your .cshrc file using the ls -a command.
  • After verifying the presence of your .cshrc file, use a Unix text editor to open it. For example, type pico .cshrc to use the simple pico text editor.
  • Scroll through your .cshrc file. You should see a list of several existing aliases. Add your new alias to the bottom of the .cshrc file's default aliases. Save the file, and exit the text editor.
  • To "activate" your new alias, you need to reinitialize the .cshrc file you just modified. From your home directory, type source .cshrc. Your alias should now be operational.

Making Directory Shortcuts with Symbolic Links

Like Unix aliases, symbolic links allow you the convenience of quickly jumping to AFS directories without having to remember and write out long absolute paths. Compared to web aliases, symbolic links (also known as "soft links") are much easier to create. To create a symbolic link to another directory, follow the steps listed below.

So (sticking with the same example), if I wanted to make a symbolic link to the OIT Web Development directory, I'd type
ln -s /afs/umbc.edu/public/www/oit/webdev/ webdev.

Once created, symbolic links are used like conventional Unix directories. When executed, the above example command created a symbolic link titled webdev in my account's home directory. If I typed in cd webdev (cd, of course, is the Unix change directory command), I would jump from my home directory (AFS path /afs/umbc.edu/users/v/e/vergil/home/ ) into the OIT Web Development directory (AFS path /afs/umbc.edu/public/www/oit/webdev/). In other words, symbolic links can make far-flung AFS folders accessible as if they were a mere one step away from your home directory.

Although you'll need to create symbolic links from the Unix command line, you can use them to jump between directories no matter what protocol or program you use to interact with your AFS account space. If you've logged into a gl Unix server using the graphical WinSCP program, you should be able to click on the folder icon representing your symbolic link and be presented with the contents of the linked directory.