Home > Uncategorized > The Bash Shell

The Bash Shell

What is a shell?
A shell is a program that acts as an intermediary between the user and the Linux kernel. The shell receives commands from the user through typed words and passes them into the kernel for processing. The kernel has the ability to communicate with hardware and gather resources like files and memory. The most common shell is bash.

History of Shells
The first shell was created by Steven Bourne in 1979 and was a part of UNIX version 7. C shell was developed as an alternative by Bill Joy of the University of California at Berkley. This shell was part of the Berkley Software Foundation Distribution (BSD), which is still popular today. The C shell functions much like C programming so users who have a background in C tend to gravitate in this direction. The Korn shell is based on a combination of the Bourne and C shells. Each of these shells have advantages and are popular in use.

The GNU project created a completely free shell called the Bash shell. It received the name from Bourne Again shell since it was based on the Bourne shell. The bash shell was written originally by Brian Fox in 1988. Bash has become the standard shell for Linux and is the default of most Linux distributions.

You can access the shell from a terminal. Open a terminal and type:
echo $SHELL

This should show you which shell you are using, like so.
/bin/bash

The procedure for interacting with bash is:
command arguments

Here is an example of listing the contents of a home directory:
ls /home/mike

The command is ls and that command acts upon the directory
/home/mike.

Here is another example:
touch text

In this example the command touch, which creates an empty file, interacts with the system by creating the file text.

In addition to commands and arguments there are also options that are available to commands. Here is an example of the ls command with the -a option which lists all files even the hidden ones.

ls -a /home/mike

Options usually require the – before the option and the option is typically one letter.

Users may use multiple options in the same command. Here is an example using ls and two options -a for all files and -l for long listing of the output.

ls -la /home/mike

You do not need to add a – for each option, one for the entire list of options is OK.

Categories: Uncategorized Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment