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 wcTo read about the man command, use this command:
% man manAnother 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:
%dateDisplay current date and time %whoShow who is logged in %lsList contents of your current directory %clearClear 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):
%glarblNonexistent command glarbl: Command not found. %dtaeMisspelling of date dtae: Command not found.
If you notice a typing mistake before you press RETURN, you ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access