UNIX Unbounded: A Beginning Approach

Chapter 3: Getting Started


This chapter introduces basic UNIX operations and commands such as logging in, changing passwords, and getting help. The objectives important to this chapter are:

  • login procedures
  • issuing commands
  • accessing help
  • correcting mistakes

Before typing anything on a UNIX system, the user should be made aware that UNIX cares more about case of letters than any other operating system. All commands should be typed exactly as noted, including the use of capitalization. YOU HAVE BEEN WARNED!

When using a UNIX system, a user is required to log in to the system, that is, to formally identify him/herself to the system. This allows UNIX to decide if the user is a valid user, and if so, what rights the user has to system resources.

When the system is started, the first thing the user should notice is the system asking for the user ID. It does so by presenting the login prompt which may look like this:


The user enters the ID that the system administrator assigned, and presses enter. The system will next ask for the user's password by presenting the password prompt:

The user should enter the current password assigned by the system administrator, or set by the user. A new user should be warned that what is typed at a password prompt is not echoed on the screen. This is normal, and is done as a security measure.

A user may change a password by entering the passwd command. Since this could also be done by someone other than the user, is the user walks away from the workstation for a few minutes, the first thing the passwd program asks for is the current password, with the prompt

Old password:

This is for the user's security. A user should keep a password private, and not tell it to anyone who might lock them out of the system for a joke or for spite. After entering the Old password, the user is asked for a New password, twice. This is to make sure the user knows what was typed and can repeat it.

Rules for choosing a password:

  • The new password and the old password must differ by at least 3 characters.
  • The password must be at least six characters long.
  • The password must contain at least two alphabetic characters and at least one numeric character.
  • The password must not be the same as the user ID.

When a user finishes a UNIX session, it is proper to log off the system. This can be done a number of ways. At a UNIX prompt, the user may type the command exit which should end the current shell session. Also, the user may press CTRL-d, that is the lower case d while the control key is held down. This will also end the current shell session. On the Unigraphics workstations, a user may end a session by clicking the Exit button at the lower right of the desktop controls. It is well to always log off, else another user may come by and continue your session. It is important to avoid this situation on systems where a user is charged for time, or where access is restricted to recognized users.

As noted in the first chapters, the UNIX system has hundreds of command available to the user. This is confusing to the user who wants to learn them all. Most users do not need to use them all. This course will demonstrate some useful ones.

The date command reports the current date, time, time zone and year to the user. It is issued to the system simply by entering the word "date" on the command line. This is useful for users who work so long on the system that they forget who and where they are.

If the user has truly forgotten who he/she is, the who command may be helpful. It reports the user ID of all users on the system at the time the command is given. It also has options which demonstrate the most common way to modify UNIX commands. Most command follow the syntax

command -options objects

The options usually (not always) follow a hyphen, and they tell the command program HOW to carry out the command. The objects are usually the files (and, remember, UNIX thinks everything is a file) that the command is to be carried out upon. Do not space between the hyphen and any option letters. If the user types
who am i

the system will respond with the user's ID, terminal number and the date of login. This method uses no hyphen. If the user types

the system will respond with the same information about all users currently on the system. (The user must then figure out personal identity by process of elimination.) The command may be issued as
who -H

which will print column headers on the screen. Another way of using the command is just
who -q

which reports a count of current users.

Another command that uses options is the cal command. It activates UNIX's built in calendar program and shows a calendar page for the month year a user requests. This one, however, does not use hyphens. Enter the command

cal 12 1997

and the system will show you a calendar page for December of 1997. You must use the full four digits for the year, such as 1997. If you enter
cal 12 97

UNIX will assume you want to look at the month of December in the year 97 (1900 years ago). Isn't that flexible of it? Try the command
cal 9 1752

to see how accurate UNIX is. (Hint: what year did the calendar change and why?)

On many UNIX systems there are tutorial programs that can be started with the learn command. Working your way through this utility may be useful to you.

The help command is more common than learn. It takes you through help about certain common UNIX commands. It is not, however, universally liked, and may be less use to you than the man command. This command activates the on-line manual for UNIX. It may be issued by itself on a command line, or you may type the word "man" followed by a specific command you would like to see the manual pages for.

Correcting typing errors on UNIX may be a challenge if you are used to other operating systems. Usually, the backspace key may be used to edit (erase) characters on a command line if you have not pressed the enter key yet. An alternative is to press CTRL-h instead of the backspace key. Now, sometimes your system is not set to understand the backspace key. If this is the case, you will notice some garbage on the screen when the backspace key is pressed, such as ^H. If this happens you can issue the following command to fix it: (if you seed some character other than H, use it instead)

stty erase ^H

You generate the ^H by typing CTRL-H. This tells the system to set the terminal to erase when the ^H is received. Do NOT use ^H in this command if you see something else at the backspace press. Use what you see.

Instead of backspacing, if you wish to start the command line over, press CTRL-u. This should erase the line and send you to the start of a new command line.

You should have an idea what a system shell is already. You may be surprised to know that there are four common shell programs available in UNIX. Your book lists two shells

  • the Bourne shell - commonly available on AT&T standard UNIX systems
  • the C shell - common on BSD standard UNIX systems

Finally, Chapter 3 talks about the process a UNIX computer goes through on boot. The diagrams on pages 47 and 48 mean to tell you that several things take place in short order:

  • the system loads the Kernel
  • the init program runs, and calls (activates) the getty program, which waits for user input
  • when the user gives login information to the getty program, it calls the login program
  • the login program collects the password from the user, verifies the user, and calls a shell program