First steps with the command line (BASH level 0)
Command line & terminal
The usual way to interact with a computer (that you are probably more familiar with) is by clicking on menus or buttons in a graphical interface. The command line is just another way to pass orders to a computer by writing instructions in a command line interface (CLI) called a terminal. The terminal generally appears as a simple windowed application (see right panel in the screenshot below as an example).
Terminals aren’t specific to a single operating system (e.g. in Windows, you can use the PowerShell). However, the language of the command line might differ from one to the other.
Why is CLI popular in the bioinformatics community?
Using the command line allows highly complex tasks by accessing either locally or remotely shared resources (e.g. files, databases, remote computing clusters…). These tasks can be coded in such a way that the multiple steps of a bioinformatics analysis can be saved into scripts. Those may then be shared with collaborators, traced and automated, things that you cannot do (as easily) with a graphical interface.
Communicating using Shell & Bash
The Shell is a software that handles command line instructions and lives in a terminal. To access the Shell’s powerful features, you need to learn a new way of thinking and a new language.
Several shells can be used to interact within the terminal (e.g. bash
, ksh
, csh
, zsh
, …). The most popular shell is Bash which is the default shell on most Linux systems. In this course, we will use the Bash shell.
The Bash shell provides you with a working space including files and directories (identical to your graphical interface). Using a Bash shell, you will be able to write and execute Unix commands. A Unix command is made of distinct parts: a command name and, if needed, options and arguments.
Particularities of the command line
- The space character is mandatory to separate all the elements in a Unix command (command name, options and arguments). You may now understand why a space in a file or a directory name is a very bad idea within an Unix environment.
- Lowercase and uppercase letters are not the same! Unix commands are case-sensitive and usually written in lowercase.