skip to primary navigationskip to content


Simple Shell Scripting for Scientists: Prerequisites

The following are the prerequisites for the Simple Shell Scripting for Scientists course. If you do not meet these prerequisites then you are likely to find it extremely difficult to follow this course, and we recommend that you do not attend the course until you do satisfy these prerequisites.

You can obtain the necessary knowledge to satisfy all of these prerequisites by attending the Unix: Introduction to the Command Line Interface course. However, if you attend the Unix: Introduction to the Command Line Interface course in order to meet these prerequisites, it is important that you PRACTICE what you have learnt BEFORE attending this course. This is because this course assumes not only that you have the relevant knowledge and skills, but also that you are actively familiar with them.

The Unix: Introduction to the Command Line Interface course doesn't cover every single one of the listed options for the various commands given below. If you have gone on this course to meet the prerequisites, or if you are unfamiliar with Linux systems, you should experiment with all the commands listed below (and, where given, the various options listed for that command) on a MCS Linux system before attending this course.


  • Familiarity with the Unix/Linux command line and running simple commands

  • Familiarity with running commands with options (e.g. ls ‑l) and combining several command-line options (e.g. ls ‑lR)

  • Familiarity with the concept of Unix file permissions

  • Familiarity with using file name globs/wildcards (e.g. *?) to specify file names (this is sometimes called file name globbingfilename expansion or pathname expansion)

  • Familiarity with piping the output of one command into another (e.g. ls | more)

  • Familiarity with redirecting a command's input (e.g. more < filename) and output (e.g. ls > filename)

  • Familiarity with running commands in the background (e.g. ls > filename &)

  • Familiarity with the concept of environment variables and with the simple use of environment variables (e.g. setting the PATH environment variable; using the export command under the bash shell).

  • Familiarity with the following Unix/Linux commands and their most common options:
    (Note: the options listed below are for the versions of these commands provided by the Bourne-Again SHell (bash), or, where a command is not provided by the bash shell, for the GNU version of that command. The GNU versions of the commands below are the versions which are the normally found on Linux systems. Other versions of these commands (notably those supplied with Solaris) may not support all these options, or may behave differently.)


Display the contents of a file.


Change the current directory.


Change file or directory permissions.


Copies files and directories. Useful options (some of which are used in this course) include:

-f or  ‑‑force

If unable to open destination file for writing, remove it and try again, i.e. forcibly overwrite destination files

-i or  ‑‑interactive

Prompt before overwriting anything


Preserve mode, ownership and timestamp attributes of copied files (where possible)

-r or  ‑R or  ‑‑recursive

Copy directories (if any) recursively, i.e. copy their contents

-v or  ‑‑verbose

Show what is being done


Display or set the system date and time.


Display text. Useful options (some of which are used in this course):


Enable interpretation of some special character sequences (backslash escapes), such as \t (display a tab character) and \n (output a newline character, i.e. advance to the next line).


Do not output a trailing newline. echo normally outputs a newline character, i.e. advances to the next line, after the text it has been told to display. This options stops it from doing that.


With no arguments, print the current set of environment variables.


Put a variable in the shell's environment, optionally setting it at the same time. This command only exists under certain Unix/Linux shells, most notably the bash shell.


Display a file one screenful of text at a time.


Find lines in a file that match a given pattern. The pattern is specified as a regular expression.


List the contents of a directory. Useful options (some of which are used in this course) include:


List one entry per line

-a or  ‑‑all

Show directory entries starting with .

-A or  ‑‑almost‑all

Show directory entries starting with . except for the implied . and .. entries


List directory name instead of its contents and do not follow symbolic links


Use a long listing format that shows lots of information about each directory entry

-R or  ‑‑recursive

List subdirectories recursively, i.e. display their contents and the contents of any subdirectories within them, etc


Make directories. Option(s) used in this course:

-p or  ‑‑parents

Make parent directories if neccessary. Also, if the directory to be created already exists, do not regard this as an error.


Display a file one screenful of text at a time. On some Linux distributions the more command is simply an alias of the less command.


Moves or renames files and directories. Note that if you move a file or directory from one filesystem to another, then mv will actually copy the file or directory and then delete the original. Useful options include:

-f or  ‑‑force

Do not prompt before overwriting destination files or directories

-i or  ‑‑interactive

Prompt before overwriting destination files or directories

-v or  ‑‑verbose

Show what is being done


Print the path of the current working directory. Option(s) used in this course:


Make sure the path printed does not contain any symbolic links


Deletes files or directories. Useful options (some of which are used in this course) include:

-f or  ‑‑force

Ignore non-existent files and do not prompt before removing files or directories

-i or  ‑‑interactive

Prompt before removing files or directories


Do not operate recursively on /

-r or  ‑R or  ‑‑recursive

Remove subdirectories (if any) recursively, i.e. remove subdirectories and their contents

-v or  ‑‑verbose

Show what is being done


Remove empty directories.


Change the timestamp of a file. If the file does not exist, create it with the specified timestamp (the default timestamp is the current date and time).


Count the number of characters, words and lines in a file. Option(s) used in this course:

-l or  ‑‑lines

Print the number of lines in the file (strictly speaking, print the number of newline characters in the file).

Useful background knowledge

The following are not prerequisites, as they are either explained during the course, or else are somewhat peripheral to it. However, those attending the course will find it helpful if they are already familiar with:

  • The Bourne-Again SHell (bash), version 2.05 or higher

  • The concepts of standard inputstandard output and standard error

  • The concept of a program's exit status (also called its exit codereturn codereturn statuserror codeerror statuserrorlevel or error level)

  • The concept of a symbolic link (also known as a symlink or soft link) and the ln command (which, when used with the  ‑s option, creates symbolic links)

  • The mktemp command, which is used to safely make a temporary file or directory


UIS Service Status

Phone padded  Service status line: (01223) 463085
Website  Sign up for SMS/email status alerts
Website  Read major IT incident reports

UIS bITe-size bulletin

A regular newsletter aimed at the University's IT community, highlighting service and project news from UIS.

Sign up >  |  Back issues

RSS Feed Latest news

Bug in iOS 14 and iPadOS 14 that affects new VPN configurations

Sep 16, 2020

The latest release of Apple's iPad and iPhone operating systems, due out today, has a bug that requires users to follow a different process when setting up a new VPN configuration. It doesn’t affect existing configurations.

AirGroup functionality expanded on University Wireless Service

Sep 15, 2020

We’ve expanded AirGroup functionality on the University Wireless Service. AirGroup enables personal devices to discover and communicate with each other via Wi-Fi – for example, it allows you to use Airplay from your mobile devices to your Apple TV.

View all news