Entering Commands The Shell You are now logged in talking to Unix. Well...not exactly. What you are actually talking to is one particular Unix program (among hundreds) called the shell. The shell is a command interpreter. This means that the shell is the Unix program that sits on the other end of the line listening to what you type, figures out what program (command) you want to run, and starts it up for you. When the program finishes, the shell comes back and asks for the next command with another % prompt. There is actually more than one shell that you can use. Normally, you use the C shell written at UC Berkeley. The actual name of the C shell program is csh. The C shell prompt always ends with the percent sign (%). There is an older shell, called the Bourne shell, that was originally written at Bell Labs. The Bourne shell's program name is sh. @foot(Athena is actually using yet a third shell, called newshell. This newshell is identical to the Berkeley C shell except that it has some additional very convenient features like those found in the Tops-20 operating system such as automatic file name completion. If you care about this, read the newshell page in the Athena Unix Commands manual, or enter man newshell. For most people, the difference is unimportant and can be ignored.) The C shell is a very powerful program, most of whose abilities are beyond the scope of this document. You can use it, for example, to run more than one program at a time. The C shell is explained fully in "An Introduction to the C Shell." This is for sale at the IPS publications office for a few dollars in 11-209. It is also included in the Athena Unix User's Guide. Online information (16 pages' worth) about the C shell is found by typing man csh. For now, the important thing to know is that the shell is your intermediary to the Unix system and its programs. Command Format The general form of a Unix command is: command options files command Unix commands are entered in all lowercase. You cannot abbreviate command names. There are currently about 250 Unix commands. A Unix "command" is really nothing more than the name of a program. options Options are the adjectives and adverbs; they modify the way that the command works, for example, "Show me all of them instead of just some," or "send it to that printer instead of the usual one." You will also see Options called "arguments," "flags," "qualifiers," and "switches" depending upon the operating system background of the person talking. Unfortunately, Unix commands are very inconsistant about they way they let you specify options. Usually: you start them with a - (hyphen or minus) sign options are: single letters (-a) single letters followed by a value (-P printer) in some newer programs, options are complete words (-draft) you can run all the single letter options together first: lpr -hf followed by all the options with values separated by blanks: lpr -hf -P laser The only way to be sure about how a command will interpret the borderline cases of its options is to look at the documentation for that command and experiment. Essential Unix shows you one form that works. files the files that you want the command to work on Separate these three pieces of a command with blanks. End commands by pressing RETURN. If you mistype the command name, the shell responds: command not found. If you make a mistake in the options, the program will show you the correct general command syntax. If there is something wrong with the file specification, Unix usually replies: filename not found, or filename: cannot open, or filename: no such file or directory. Change Your Password: passwd To protect your work and privacy, you should change your password often. To change your password, type the Unix command @i(passwd). Passwd will prompt for your old password, then ask you twice for your new password. Neither your old nor your new passwords will show on the screen as you type them. The procedure looks like so: mit-host% passwd Changing passwd for yourlogin Old password: <--- you enter it invisibly New password: <--- you enter it invisibly Retype new password: <--- enter it again mit-host% If you try to pick a password that is less than five characters long, Unix will complain. If you really want the short password, insist three times and Unix will give up and let you have your way. Getting Help Documentation: man and apropos Unix keeps a massive amount of information about itself available "online." Indeed, the entire Unix Programmer's Manual--what Project Athena sells as its Commands, Functions, User's and Programmer's guides--is available online. There are two commands that let you access this information, man and apropos. You use man when you know the command you want to use and just want to refresh your memory about its options. You use apropos when you know what you want to do, but you don't know what commands, if any, do it. The format of the man command is: man command Man will search through its database looking for an exact match for command. If it finds it, it displays it on your terminal screen. The NAME section gives a one-line summary of what the command is. The SYNOPSIS section shows you how to enter the command. You don't type the [] characters. These only mean that the option can be ommitted. The DESCRIPTION section explains the command and its options in greater detail. To get man to go on to the next page, hit the SPACEBAR. When you've seen enough, enter q or CTRL-C. Man takes some getting used to. First, you may have trouble understanding the information. Most of it was written by programmers for programmers. It tends to define rather than explain. Next, man contains many entries that are not commands. Man has 8 sections; only sections (1) and (6) are commands. The rest are system calls (2), subroutine libraries (3), I/O devices (4), files (5), games (6), odds 'n ends (7), and system manager tools (8). Sometimes you may think you've found a command and try to execute it when what you've really found is the name of a Fortran subroutine. The top line of the man page tells you what section you're looking at. The format of apropos is: apropos keyword where keyword is any word you can think of that might describe what you're looking for. apropos searches the one-line descriptions of the manual pages looking for the keyword. It them prints all the matches it has found. You then use man to look at the actual entries. apropos also takes some getting used to. You don't usually find what you want on the first try. You often fail to find it altogether. Pick your keywords broadly. "file" is a good desperation choice. You can get apropos to list all the entries in a given section of the manual. To list all the games, for example, say: host% apropos '(6)' Practise using man and apropos. They are a mainstay of a Unix user's life. We assume that you will "look at the man page" for every command introduced in Essential Unix to learn more about its functions. More online Unix documentation is kept in the network of files and directories beneath /usr/doc. (Directores are explained in a later section.) The free Athena document Start Here catalogs all the documentation available. Consultants If you have a question about Unix, the best first strategy is to ask the person next to you. Unix has a very strong oral folklore. Most Athena clusters are staffed by student consultants during the day. They will be wearing some article of clothing that identifies them, likely decorated with an underground version of the Athena owl. Student consultants can answer general questions about the system, but cannot be expected to know the nooks and crannies of every compiler and package on the system. ???Phone? old?? Hardware Trouble If you think there is a hardware malfunction, first seek out a consultant to analyze the situation. It usually isn't hardware. If no consultant is available, call the Athena Hardware Hotline (25)3-1410.