Confused about Unix, or just curious? Having trouble doing certain things on Athena? In this column, we will answer some basic questions about using Athena and the Unix operating system.
Did the combo change?
Yes; the combo to the Athena clusters changes every October. To find the new combo, you can log in to a quickstation or a dialup and type
athena% tellme combo
Other things tellme supports are tellme root, for the root password, and tellme why.
What’s this terminal thing that pops up when I log in?
The “terminal thing” is a Unix command prompt. You can type in commands and run applications from this window.
To run a program, simply type the name of the program. For example,
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 mailmaint, pine, or owl) or asks for user input (such as less), however, you should not use &.
How do I move between directories?
To go into a directory inside your current directory, type
athena% cd directoryname
To list the contents of a directory (including its subdirectories), you can use the ls command:
athena% cd 6.034-psets
ps0 ps1 ps2 ps3 ps4 ps5
Keep in mind that you can move as far down the directory structure as you want with one cd (“change directory”) command. For example, if you wanted to access a directory called “resume” in your Public directory, you can type
athena% cd 6.034-psets/ps0
from your home directory. If you now wanted to go back to your 6.034-psets 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 path names?
Yes! You can use tab completion. Whenever you are typing in a pathname as part of a command, you can enter part of it and then hit the Tab key. The command shell 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[TAB]
When you hit Tab at the end, if you have no other files whose names begin with “stupid,” the shell will complete it:
athena% emacs stupidlylongfilename
If there are two or more valid completions, the shell will list them for you.
What commands can I use to copy, move, and rename files?
To move a file, type
athena% mv old/path/to/file new/path
For example, if you wanted to move a file named “foo” from your Public directory to your current directory, you can type
athena% mv Public/foo .
(The dot at the end is notation for the current directory.)
To rename a file, just give the new name, e.g.:
athena% mv foo bar
To copy a file, type cp instead of mv.
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 and make it a hidden file. To delete a directory and its contents, use delete -r. 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’re familiar with Unix, you may know about the rm command, which also works, but doesn’t let you use undelete.
How can I recover a file I accidentally deleted?
If you’ve just typed delete, then you should first try undelete. If your file can’t be undeleted, you may still have a backup. Athena makes a nightly backup copy of your entire home directory , 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.
If OldFiles has already been updated, you have one last hope: the AFS administrators have tape backups that they should be able to retrieve for you. Contact firstname.lastname@example.org with the full path name of the file and the approximate dates that it existed, and they’ll get in touch with the AFS administrators.
To ask us a question, send e-mail to email@example.com. 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 Web site: http://www.mit.edu/~asksipb/.