Main index

Introducing UNIX and Linux


Getting started

Overview
Using UNIX
      Usernames
      Logging in
Logging out
Commands
      Typing in commands
      Commands and options
Communication with other users
      Email
      Other communication facilities
Files
      The editor Vi
            Vi commands (command mode)
            Vi commands (colon mode)
      Other editors
Input and output
      Scripts
      Here-documents
      Pipes
      Making copies of input and output
      Pagers
Emergencies
Getting help
Summary
Exercises

Typing in commands

After you have logged in, and a command window is available, the system will prompt you to type in a command. The prompt is usually $ (dollar), though many systems are able to change this, and you yourself are able to alter it.

Beware, however, if you get a prompt that terminates in % (percent) - this is usually an indication that the shell you will talk to is either the C shell or a derivative of it, and not a POSIX shell. Although most of the next couple of chapters will still be valid for such a shell, there are significant incompatibilities, and much of the next three Chapters will not be correct. In such a circumstance, it may be possible for your login shell to be changed to a POSIX shell (such as bash). Again, consult your system administrator. Note that Linux distributions always have a POSIX shell set up as the default.

Try now typing date (remembering to press the Return key at the end). You should see on the screen something like

$ date
Tue Dec 4 20:10:39 GMT 2001
$

By typing date you have instructed the machine to obey the command called date; it has executed the command and has printed on your screen a message (as instructed by the command date). When that command completes, you are then given another prompt. Try now typing nonsense - you should get something like

$ qwerty
qwerty: command not found
$

telling you that it doesn't understand what you've typed in.

The command date is the name of a program - it's written in machine code, and you don't need to know the details of how it works, just what it does. To describe a program such as date being obeyed, we use the words running or executing.

You will have been notified of the command you must type for changing your password; this is usually passwd, although some system administrators prefer to install their own command. On some systems passwd can work very slowly, and your new password may not take effect until a few minutes after you have entered it, especially if your UNIX system is a network of machines rather than a single computer.

Note that passwd is not a standard POSIX command, since the shell does not specify how to authenticate users.


Copyright © 2002 Mike Joy, Stephen Jarvis and Michael Luck