2 Synthesis‎ > ‎Computing‎ > ‎Linux‎ > ‎


The shell is a user program that provides a command prompt on a terminal, and processes the typed commands.

The shell is started from the init process, the first process to automatically run at startup of the computer.
There are various shells that can be used in Linux. Here I talk about the bash shell.

Once in a terminal the shell provides a prompt which is a $ for a normal user or a # for a root user. Also the prompt usually looks something like this;


To find out which shell you are using, type echo $SHELL like this;

    tom@gold:~$ echo $SHELL

and if its the bash shell which is the commonest the system responds bin/bash;

Typing id tells me about myself on the system.

    tom@gold:~$ id
    uid=1000(tom) gid=1000(tom) groups=1000(tom), 4(adm), 108(lpadmin)

This tells me that user "tom" has a user id (uid) number of 1000 and that his primary group has a gid of 1000 also . Additionally to this is a list of the groups that tom belongs to. Each group has access rights to various things on the system and because Tom is a member of a particular group it gives him access rights to the things that are accessible to that group. Later we look at access in detail.

Another useful command is who. This tells you who is logged on and the processes running for that user, since when it was running, how long it was idle and what the process numbers are, (called Process IDs or PIDs;

    tom@gold:~$ who -uH
    NAME     LINE         TIME             IDLE          PID COMMENT
    tom      :0           2016-03-10 19:45   ?          1841 (:0)
    tom      pts/1        2016-03-11 14:41   .          7419 (:0.0)

The Comment shows the name of the computer that has been logged on to. However because I was logging on to my own system I get (:0) meaning my desktop and (:0.0) meaning the terminal I am running on my desktop.

To find the current process working directory;

    ttom@gold:~$ pwd

This is the starting directory for your terminal

Looking at the sub-page Files tells you more about what you can do from here.

The Manuals

The Linux manuals are the most valuable resource you can learn to use and could arguably be said to beat any book. Bring up a terminal and type; 

   man intro

Read these properly and you will be given a basic introduction to using the shell. Type q to quit and return to the command prompt.

The manual is divided into sections. Type;

    man man

For any command that can be typed into the shell there are manual pages;

    man <command>

substitute <command> for the command you are interested in.

Another way of getting information is;

    info <command>

again substitute <command> for the command you are interested in. Info often returns the same text but not always. Try;

    info ls

    man ls

On my system info gives a more English description.

Man pages are the UNIX traditional way of distributing documentation and correspond to the pages of the printed manual; the man pages "sections" correspond to sections in the full UNIX manual.

  1. Executable programs or shell commands
  2. System calls (functions provided by the kernel)
  3. Library calls (functions within program libraries)
  4. Special files (usually found in /dev)
  5. File formats and conventions eg /etc/passwd
  6. Games
  7. Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
  8. System administration commands (usually only for root)
  9. Kernel routines [Non standard]

Info is the default format for documentation inside the GNU project. Info uses Texinfo as its source format, which is a bunch of macros for TeX, and that makes it much easier to also create "good-looking" printed versions or PDFs.

Where is the manual kept? The command manpath shows the paths that are searched for manual pages but they may well be buried in subdirectories.

     man -wa command

will take you to the file for a given command.

An HTML version of the manual can be found;

Other interesting commands;


Tells you;

These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

And then it gives a list of commands.

Unrelated to this is;

    info help

Well it looks interesting but what it is supposed to do?!

You can also get help on many commands with;

<command> --help

© Tom de Havas 2011. The information under this section is my own work it may be reproduced without modification but must include this notice.