Loughborough University
Leicestershire, UK
LE11 3TU
+44 (0)1509 222222
Loughborough University

IT Services : High Performance Computing

Linux Tutorial Introduction


Preamble

Linux is a common operating system. By operating system, we mean the suite of programs which make the computer work. Linux is used by the workstations and multi-user servers throughout the world.

On workstations, X Windows provide a graphical interface between the user and Linux. However, knowledge of Linux is required for operations which aren't covered by a graphical program, or for when there is no X windows system, for example, in an ssh session.

Linux and UNIX

Linux is a free version of UNIX. Whilst Linux is not officially UNIX you will find most of the tutorial applicable to official UNIX (Solaris, AIX, HP-UX, IRIX, etc.) and other UNIX-like operating systems (e.g. FreeBSD, NetBSD, etc.)

The Linux operating system

The Linux operating system is made up of three parts; the kernel, the shell and the programs (sometimes called 'userland' and often using free software from the GNU organusation, hence Linux is sometimes called GNU/Linux to distinguish it from Linux used in phones, TV, and washing machines which lack or have a different 'userland').

The kernel

The kernel of Linux is the hub of the operating system: it allocates time and memory to programs and handles the filestore and communications in response to system calls.

As an illustration of the way that the shell and the kernel work together, suppose a user types rm myfile (which has the effect of removing the file myfile). The shell searches the filestore for the file containing the program rm, and then requests the kernel, through system calls, to execute the program rm on myfile. When the process rm myfile has finished running, the shell then returns the Linux prompt to the user, indicating that it is waiting for further commands.

The shell

The shell acts as an interface between the user and the kernel. When a user logs in, the login program checks the username and password, and then starts another program called the shell. The shell is a command line interpreter (CLI). It interprets the commands the user types in and arranges for them to be carried out. The commands are themselves programs: when they terminate, the shell gives the user another prompt.

The adept user can customise his/her own shell, and users can use different shells on the same machine.

The bash shell has certain features to help the user inputting commands.

Filename Completion - By typing part of the name of a command, filename or directory and pressing the [Tab] key, the tcsh shell will complete the rest of the name automatically. If the shell finds more than one name beginning with those letters you have typed, it will beep, prompting you to type a few more letters before pressing the tab key again.

History - The shell keeps a list of the commands you have typed in. If you need to repeat a command, use the cursor keys to scroll up and down the list or type history for a list of previous commands.

Files and processes

Everything in Linux is either a file or a process.

A process is an executing program identified by a unique PID (process identifier).

A file is a collection of data. They are created by users using text editors, running compilers etc.

Examples of files:

  • a document (report, essay etc.)

  • the text of a program written in some high-level programming language

  • instructions comprehensible directly to the machine and incomprehensible to a casual user, for example, a collection of binary digits (an executable or binary file);

  • a directory, containing information about its contents, which may be a mixture of other directories (subdirectories) and ordinary files.

The Directory Structure

All the files are grouped together in the directory structure. The file-system is arranged in a hierarchical structure, like an inverted tree. The top of the hierarchy is traditionally called root as an analogy to spreading tree roots.

Attribution

Original version by M.Stonebank@surrey.ac.uk, 9th October 2000. Modified by a.turner@lboro.ac.uk, 2015.