Introduction to the Linux command line

Linux and the command line

Linux is an open source operating system – anyone can use, modify and distribute this software and it is maintained by a group of dedicated developers, cool huh!?

You will find that many tools commonly used in bioinformatics have been designed for Linux.

High performance computing clusters or HPCs often rely on Linux operating systems too so if you want to run computationally intensive jobs, for example when working with genome datasets, chances are you will need to learn the Linux command line and the use of command line tools.

What is the command line?

The command line is the method of interacting with a computer from a terminal.

Instead of running a program or command from a graphical user interface (GUI) you type text into to your computer’s terminal and press the ‘Enter’ key to initiate the text command which then runs the program.

You can think of the terminal like a chat box, where you can chat with your computer and give it detailed instructions.

Your computer cannot directly read your text, instead it uses a command line interpreter.

Bash (Bourne Again SHell) is one of the most widely used command line interpreters on Linux systems.

Bash, like other interpreters, converts commands (the human-readable text) into binary machine code (1s and 0s) that the computer’s central processing unit (CPU) can understand and then execute.

We can also use bash to write pipelines, in the form of a bash script, to combine multiple tasks into one (we will revisit this a little later on).

How can I access the command line?

We can access the command line through the computer’s terminal.

The terminal, also known as the command-line interface (CLI) or console, is the program that provides the user interface with a computer’s operating system.

On a Linux computer we can access the terminal by typing Ctrl + Alt + T.

If you don’t have access to a Linux computer don’t worry! We will be using an online Linux virtual machine to practice.

For the exercises in this post I will be using JSLinux hosted by Fabrice Bellard you can access it here.

Click on the first link under Startup Link.

Now you should be taken to a page with a Linux terminal, it should look like this:

A note on command line completion

It is important to remember that computers will take things completely literally – so you need to be extra careful about spelling when using the command line.

The command line doesn’t error check but it can fill in the commands it knows using autofill (you can do this by using the tab key after you start typing a command and it will complete the word for you – a bit like auto-correct but you do have to start typing it correctly!

On the next page we will go through some essential command line tools to help you navigate your Linux computer vis the terminal.