Chapter 2. A Shell Primer

In This chapter:

  • Entering Commands

  • Command Input and Output

  • Files and Directories

  • Combining Commands

  • Running Commands in the Background

  • When Do Spaces Matter?

  • The Shell Startup Files

This chapter provides a simple, quick introduction to the shell. You should read it if you’re a newcomer to the shell and/or UNIX, or if you want a general review before reading the rest of this handbook.

If a command used here is unfamiliar to you, try the man command to read the relevant online manual page. For example, if you don’t know what wc is when it appears in an example, you can find out that it’s a word-counting program by using the following command:

% man wc

To read about the man command, use this command:

% man man

Another helpful reference is the O’Reilly & Associates handbook UNIX in a Nutshell.

Entering Commands

To enter a command, type it and press the RETURN key. Some commands are simple enough that you can run them by typing just their name. Here are a few:

% date                          Display current date and time
% who                           Show who is logged in
% ls                            List contents of your current directory
% mail                          Read your mail
% clear                         Clear the screen
% logout                        (or exit) Terminate your login session

You’ll get an error message if the shell can’t find a command (errors usually occur when the command is nonexistent or you spelled its name incorrectly):

% glarbl                       Nonexistent command
glarbl: Command not found.
% dtae                         Misspelling of date
dtae: Command not found.

If you notice a typing mistake before you press RETURN, you ...

Get Using csh & tcsh now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.