Research Computing | Linux Command Line

Video
Transcript or Alternate URL: 

In this module, we will continue our discussions about the Linux Operating system with a short description of the Linux Command Line Interface, or the “Shell” as it is more commonly known. At the conclusion of this module, we hope you will have a better understanding of what the “shell” is, and how it functions as a part of the Linux system.

Typically, the shell is accessed in one of the following ways:
1)Opening a program that provides access to a local shell – this is often known as a ‘terminal’; 2)Connecting to a remote system via the SSH program; or 3)Logging into a computer that does not have a Graphical User Interface installed.

The shell, also known as a command-line interpreter, is a relatively simple program that only does exactly what its name suggests -- It interprets the commands that it receives and gives those instructions to the operating system in a manner that the Operating System understands.

This means that the shell does precisely two things:

1)First, it reads commands typed in from the keyboard, and 2)Then, it translates those commands and passes them along to the operating system.
Commented [RL1]: Please add a slide about this part to give the audience a clear vision on what they gonna learn in this video.
Commented [RL2R1]: Please refer to module 2_1 when finalizing the format of slides
Commented [RL3]: Need a slide in PPT with key points
Commented [RL4]: Need a slide in PPT with key points

Once these commands are received, the operating system will decide what to do with them.
If they were typed in correctly, the command will generally work – meaning that a program is run, or a file is copied, or whatever task is specified by the command will be carried out.
Alternatively, if the operating system does not understand the command, or it cannot perform the task as it was specified, the shell will pass back an error message that may explain what went wrong.
Historically, the command line interface was the onlyuser interface available on a computer. Today, we have graphical user interface – called GUIs -- in addition to command line interfaces such as the shell.

On many Linux systems, the shell is provided by a program called bash -- which stands for Bourne Again Shell. This is an enhanced version of the original Bourne shell program – called sh -- written by Steve Bourne.

There are several additional shell programs available on a typical Linux system. These can include:
 ksh, or Korn Shell csh and tcsh, or C Shell zsh, also known as Z Shell

There are many books written about Linux command line shells. If you are interested, we encourage you to take a look.

However, out of all the available shells, the bashshell is the most commonly used. When you open your terminal program, or log into a remote system, there are a few useful things to know.
First, The initial information printed in the Terminal window is known as the prompt – or the command prompt. This is the point where information is typed in to pass along to the operating system.

In this slide, we can see an example prompt that we will be using to explain the different sections of the standard bash prompt.
First -- the green section -- is the username. This tells us what account was used to log into the computer. This will also tell you if you are currently acting as the ‘root’, or system administrative user. It is not a good idea to use the root account to perform day to day actions. Always try to make sure you use a regular account to do your work
Second, the red section tells us the name of the computer to which we are connected. If a shell is opened on the local computer, this information is often not displayed. Using this, we can tell if we are logged into a local computer, or if we have connected to another computer through SSH.

Third, the dark blue section tells us where we are located within the Linux filesystem. The tilde (~) in this section tells us that we are currently in our user’s “home directory”. Please refer to our first module for more information on files and directories in the Linux Operating System.