The Shell

When you log into a unix system in text mode, or open a terminal window in GUI mode, you are running a program called a shell. The shell is a command interpreter. You type commands, and the shell carries out those commands (by running other programs, etc.). You primarily interact with the unix OS by entering commands at the shell's command prompt. If you have ever used MS-DOS, or a DOS Window in Microsoft Windows, then you have experienced a shell.

While there are many shells available, the standard shell for a GNU/Linux system is bash. The normal command prompt for bash is a dollar sign, often preceded by various information such as the current working directory and your username.

When you enter a command at the shell prompt, the shell interprets the command, passes it to the kernel, then displays the results of the command back to you.

Most commands are a combination of the command name, switches, and arguments. For example, in the command ls -l *.html, ls is the command name (the command for listing files). Minus ell, -l, is a switch meaning give a detailed (long) listing instead of the default brief listing. Finally, *.hmtl is the argument, in this case containing a wildcard (the star matches any string of letters).

The net effect of this command is to request a long-format directory listing of all files whose names end with .html. The result might look like:

Example 1-1. Typing a command in the shell


$ ls -l *.html
-rw-r--r--    1 dbindner dbindner     5997 Mar 23 15:01 commands.html
-rw-r--r--    1 dbindner dbindner     1030 Mar 23 15:01 edit.html
-rw-r--r--    1 dbindner dbindner     1175 Mar 23 15:01 environment.html
-rw-r--r--    1 dbindner dbindner      780 Mar 23 15:01 files.html
-rw-r--r--    1 dbindner dbindner     2996 Mar 23 15:11 fs.html
-rw-r--r--    1 dbindner dbindner     1758 Mar 21 23:58 index.html
-rw-r--r--    1 dbindner dbindner      428 Mar 23 15:01 indx.html
-rw-r--r--    1 dbindner dbindner      627 Mar 23 15:01 install.html
-rw-r--r--    1 dbindner dbindner     1538 Mar 23 15:01 intro.html
-rw-r--r--    1 dbindner dbindner      550 Mar 23 15:01 jobs.html
-rw-r--r--    1 dbindner dbindner      687 Mar 22 21:33 kernel.html
-rw-r--r--    1 dbindner dbindner      473 Mar 23 15:01 links.html
-rw-r--r--    1 dbindner dbindner      511 Mar 23 15:01 network.html
-rw-r--r--    1 dbindner dbindner     1726 Mar 23 15:14 shell.html
-rw-r--r--    1 dbindner dbindner     1339 Mar 23 15:01 start.html
-rw-r--r--    1 dbindner dbindner      555 Mar 22 16:31 template.html