Ask SIPB - August 25, 2003

Confused about Unix? Having trouble doing certain things on Athena? In this column, part 3 of 6 of our introductory Orientation columns, we will answer some basic questions about using Athena and the Unix operating system.

What's this terminal thing that pops up when I login?

The "terminal thing" is like the equivalent of a command prompt (in Windows) for Unix. You can type in commands and run applications from this window.

The menu bar at the bottom of your screen on Athena functions similarly to a Windows Task Bar, and the button labelled "Menu" functions like a Windows Start Menu. The four buttons corresponding to "Mail," "WWW," "Prompt," and "Emacs" are the Unix equivalent of the "Quick Launch" bar. When you minimize applications, they will show in the task list just like in Windows. To run a program, simply type the name of the program. For example,

athena% pine
To run a program in the background, type the name of the program followed by &. For example,
athena% mozilla &
Running a program in the background allows you to continue to use your prompt after the program launches. If you do not use the &, then you cannot type any more commands until you close the program you launched.

If you are running a text based program that uses the entire terminal window, such as emacs, pine, or owl, or asks for user input, such as less, however, you should not use &.

This terminal looks ugly. How can I change this?

The default terminal in the current version of Athena is gnome-terminal. If you want to change its settings, including the font, go to Settings->Preferences (for Linux) or Edit->Current Profile(s) (for Solaris).

If you want to use a different style of terminal, you can type

athena% xterm &
If you like this style of terminal and want to have it as the default for when you log in, you can add set skip_initial_xterm to your .environment file and xterm & to your .startup.X file. You may have to create these files; they should go in your home directory.

If you also want to change the "Prompt" button on your GNOME panel (the bar at the bottom of your screen), you can right click it and select "Properties..." Replace the text in the box labeled "Command:" with xterm.

How do I move between directories?

To go into a directory inside your current directory, type
athena% cd directoryname
Keep in mind that you can move as far down the directory structure as you want with one cd command (cd is short for "change directory"). For example, if you wanted to access a directory called "resume" in your Public directory, you can type
athena% cd Public/resume
from your home directory. If you now wanted to go back to your Public directory, you can type
athena% cd ..
to move up one level in the directory structure. You can also type cd to return to your home directory.

To make a new directory in the current directory, use mkdir directoryname.

Is there an easy way to avoid typing long pathnames?

Yes! You can use tab completion. Whenever you are typing in a pathname, you can enter part of it and then hit the Tab key. Unix will try to complete it for you automatically. For example, if you had a textfile called "stupidlylongfilename," and you wanted to edit it with emacs, you can type
athena% emacs stupid
hit Tab, and if you have no other files whose names begin with "stupid" Unix will complete it:
athena% emacs stupidlylongfilename
If there are two or more valid completions, Athena will list them for you.

What commands can I use to copy, move and rename files?

To copy a file, type
athena% cp pathoffile destinationpath
For example, if you wanted to copy a file named "foo" from your Public directory to your home directory, you can type
athena% cp Public/foo .
from your home directory. (The dot at the end is notation for the current directory.)

To move a file, type

athena% mv pathoffile destinationpath
and to rename a file, type
athena% mv pathoffile newfilename

How do I delete files?

If you want to be able to recover your files later, you can use the delete command.
athena% delete filename
This will mark that file for deletion; it will be renamed .#filename. You should be aware that the system will automatically remove marked files periodically. You can list the files that have been marked by using the command lsdel. To recover a marked file, you can undelete it.
athena% undelete filename
If you want to immediately delete a file, you can type
athena% rm filename
To remove an entire directory, type
athena% rm -r directoryname

How can I learn more about managing my files?

For more detailed information about managing your files with these commands, you can attend the Athena Minicourses running during Orientation. There are two separate classes: "Athena: The First Course," and "Working on Athena: Files and Unix." Today through Wednesday, these classes are at 9 AM and 10 AM respectively in 26-100. On Thursday and Friday, these classes will alternate each hour, starting at 9 AM, and ending with the final class at 3 PM. For more information on these classes, you can visit http://web.mit.edu/minidev/www/.

How can I recover a file I accidentally deleted?

Fortunately for you, Athena keeps a backup copy of your entire home directory. It is updated nightly, so if you accidentally remove a file, you still have some time to recover it. The copy, as of 3AM, is kept in "OldFiles" in your home directory. You can recover your file by copying it back.

If OldFiles has already been updated, there is still hope. You can email afsreq@mit.edu with the full pathname of the file and the approximate dates that it existed on disk. If you're lucky, they should be able to recover it for you from back up tapes.

What is a locker?

A locker is an organizational structure used to group related programs together, and also allow you to conveniently run them without typing the entire path to a program. Courses have lockers to store their programs and data. Users also have lockers, which are their home directories.

How do I run a program from a locker?

athena% add lockername
will add the locker for your current login session. This means that you don't have to enter the entire path for the program; you can just type
athena% programname &
Adding the locker is convienent if you expect to access multiple files and programs in the locker. However, if you only want to run one program from a locker and not bother with adding lockers, you can type
athena% athrun lockername programname &


To ask us a question, send email to sipb@mit.edu. We'll try to answer you quickly, and we can address your question in our next column. You can also stop by our office in W20-557 or call us at x3-7788 if you need help. Copies of each column and pointers to additional information are posted on our website: http://www.mit.edu/~asksipb/