The Unix environment is almost always "networked"; the various resources that you use, (such as files) are often hosted somewhere else. This allows you to move transparently among sets of computers. The Windows system can also be configured like this, but Unix allows much more flexibility. In particular, Unix can have multiple users who can connect via the networked environment, easily sharing files.
The shell is both an interactive interface to the operating system and a programming language. We will be focusing on interactive use for this course. The shell acts as an interpreter between the user and the system. Commands are entered to the shell which interprets the command and performs the action the user requested.
There are many different shells which can be used on different Unix systems. Cshell and bash shell are probably the two most commonly used shells but there are numerous others. One of the first was the Bourne shell, 'sh'. For this course, we will be using the bash shell which derives it's name from the fact that it's programming syntax is somewhat similar to the Bourne shell, but with some C-shell and other extensions, and hence is the "Bourne-Again-SHell". Most of what we will learn will apply to other shells although the syntax may vary depending on the particular shell.
The shell is not the command window (not necessarily). Often a terminal window is thought to be the shell. Different shell can be operated within the same terminal window or console.
Nearly all Unix commands follow the same basic structure in how they are entered.
command -option argument --more-options
[loriotg@gollum ~] uname Linux [loriotg@gollum ~] uname -m i686 [loriotg@gollum ~] uname -m --processor i686 unknown [loriotg@gollum ~] uname -mp i686 unknown [loriotg@gollum ~] uname --operating-system GNU/Linux [loriotg@gollum ~] uname -a Linux gollum 2.6.32-32-generic #62-Ubuntu SMP Wed Apr 20 21:54:21 UTC 2011 i686 GNU/Linux [loriotg@gollum ~]
To get help on a unix command, the most common source is the
manual pages. The
man program is used display the
manual page for a program.
As an example, if we wanted to get more information about the
man program we could enter:
If found, the man program will display the page in a viewer on the terminal. Manual pages are structured in the same manner for each command. They start with the "name" which names the program and provides a very brief description of the program. The "synopsis" section shows how the command is implimented with an often overly verbose example. The "description" section will explain what the command does and how it works. The "options" section explains how each available option will modify the behavior of the program. There are several other sections which may follow in the man page depending on the command. The man page viewer can be terminated by hitting the "q".
The collection of man pages may be searched with the
apropos command. This will allow a simple keyword
search of the brief descriptions for each command. The option
"-k" to the
man command will also perform the
apropose search (Example:
man -k uname).
whatis command does a similar search as the
apropos command but searches the command names instead
of the descriptions.
There are number of other sources of help on a Unix system. Many
programs will display a brief help description if entered with the
long option "
--help". This is typical for
GNU utilies found on Linux and FreeBSD but less often on commercial
versions of Unix.
The GNU project also provides "info"
documents for their help files. The info documents are often much
more descriptive and allow browsing between chapters rather than a
linear stream of text like the man pages. Unfortunately the info
viewer is much more complex to navigate and will usually require
some effort to learn how to navigate. The info viewer is invoked
with the command
On Linux systems there is usually a collection of documents found on the file system in the /usr/doc/ directory. These can be in many forms (plain text, postscript, html, pdf, etc.) The information here is often more detailed but is not consistent in it's quality or depth.