The Tech - Online EditionMIT's oldest and largest
newspaper & the first
newspaper published
on the web
Boston Weather: 37.0°F | Fair

Ask SIPB

STUDENT INFORMATION PROCESSING BOARD

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.

Question: What's this terminal thing that pops up when I log in?

Answer: 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 much like a Windows Task Bar, and the button labeled “Menu” 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.

However, 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), you should not use &.

Question: This terminal looks ugly. How can I change this?

Answer: 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. Using a text editor such as pico, emacs, or vi, you can edit the appropriate files.

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,” then replace the text in the box labeled “Command:” with “xterm.”

Question: What is a directory and how do I move between directories?

Answer: A directory is like a folder in Windows. 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”) and that Unix is a case sensitive language. 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, type:

athena% mkdir directoryname

Question: Is there an easy way to avoid typing long pathnames?

Answer: 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 text file 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 with names that begin with “stupid,” Unix will complete it. If there are two or more valid completions, Athena will list them for you.

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

Answer: 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

Question: How do I delete files?

Answer: 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

Question: How can I learn more about managing my files?

Answer: 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.” These classes are today through Wednesday at 9 a.m. and 10 a.m., respectively in 26-100. On Thursday and Friday, these classes will alternate each hour, starting at 9 a.m., and ending with the final class at 3 p.m. For more information on these classes, you can visit http://web.mit.edu/minidev/www/.

Question: How can I recover a file I accidentally deleted?

Answer: 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 3 a.m., is kept in “OldFiles” in your home directory. You can recover your file by copying it back to your desired directory.

If OldFiles has already been updated, there is still hope. You can e-mail 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.

Question: What is a locker?

Answer: A locker is an organizational structure used to group related programs together, and also allows 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.

Question: How do I run a program from a locker?

Answer:

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 convenient 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 &