Introduction to Linux
Following is a short introduction to Linux. We shall encounter some buzz words such as terminal, command line and other utilities. Have fun!
Some history
Early in the 90’s, a young Finnish student named Linus Benedict Torvaldsa wanted to set up his own Operating System (OS). The idea consisted of developing a Unix-type system with 80386 processors (or, a PC, to put it simple). Andrew Tanenbaum created Minix, a basic system compatible with the 80386’s. This is how Linus B. Torvaldsa decided to improve the project by extending the capabilities of Minix: Linux was born. The kernel (the system core), numbered 0.1, was made available in 1991. But it was only in 1992 that the stable version was finally out. What makes this system original is the fact that it is non commercial and many developers participate in this project.
Today, many distributions exist: Debian, Fedora, FreeBSD, Gentoo, Knoppix, Mandriva (merge between Conectiva and MandrakeSoft), Red Hat, Suse, Slackware, Ubuntu , and so on so forth. There is a wide selection ! Note that if you start using Linux, opt for Mandrake or d’une Knoppix. This latter does not even require installation!
The console
The console or terminal is text environment in which the user launch programs to be executed or sends requests. There are several types of consoles: terminal, xterm, konsole, gnome-console, virtual terminals, etc. The virtual terminals are launched via the command CTRL+ALT+F1, CTRL+ALT+F2, CTRL+ALT+F3, etc … The console shown below is a gnome-terminal.
The line
is what we call a prompt, nadir is the (user) and ipowerht is the name of the machine. The tilde ˜ refers to the current directory of the user; i.e. /home/nadir Alternatively stated, the prompt shows clearly in which directory we are. In our case, we are in /home/nadir/Desktop/these. As for the dollar sign, $, it means that we are under the control of the command interpreter: the shell BASH.
So what is BASH exactly? It is nothing else than a program {/bin/bash} which interprets the commands you type and executes them, as long as there are not erroneous. In particular, BASH is case sensitive: a lower case is not the same as an upper case !
We previously mentioned that the tilde ˜ represents /home/nadir. Obviously, if the user is Astozzia, the tilde on the console will represent /home/astozzia. Each user has a subdirectory in /home. A better image to understand this concept is to imagine that all users live in /home and each of them has their own “room”: that of nadir is /home/nadir, that of astozzia is /home/astozzia. Obviously, astozzia cannot enter nadir’s room since this latter is private. And vice versa. However, nadir can share a part of his room with astozzia, as we shall see later.
Basic commands
This command is a must !!! ‘man’ is an abbreviation of manual. Practically, we type
The console will display a lot of info on the ls command. We can ask for condensed help as follows:
ls lists the contents of a directory
It is possible to use several options with the ‘ls’ command. See the manual ! We shall mention the -l option
A few comments:
- total 96 means that the directory named CV occupies 96 blocks
- the first column gives information on the rights ;
- the second shows the number of links pointing to this file ;
- the following column shows the name of the file owner ;
- the fourth column shows the name of the group who can have access to this file according to the actions authorized by the owner. If you remember, it is what we referred to as file sharing between nadir and astozzia ;
- the fifth column shows the size of the file in bytes.
- the sixth gives the date and time of the last modification of the file.
- the last column refers to the name of the file.
This command gives the path to the directory in which we are
cd as in Change Directory. To change to the top-level or root directory of the system
To change to the var directory of the root directory
To change to the current directory www
To change to the /usr/bin directory
To go to the parent directory
To change to my personal home directory
To change to the home directory of astozzia
This command creates a directory: Make Directory
will create a subdirectory called Photos in the directory ~/Desktop/CV
This command copies files. To copy the file ‘cvnadir.tex’ in ‘cv.tex’ (Duplication), we type:
To copy the file’ cvnadir.tex’ in the directory ~/Desktop/CV
To copy files from the directory ‘analysis’ into the directory ‘algebra
To copy all files from the directory ‘analysis’ – including all subdirectories – in the directory ‘algebra’
The command mv renames a file or moves it to a new location. The following command for example renames the file ‘cvnadir.tex’ into ‘cv.tex’
To move the file ‘cv.tex’ into the directory ‘/home/nadir/fac’, we proceed as follows:
This command displays the contents of a file
If you have 2 files file1, file2
will display the contents of the two files: this is called ‘concatenation’. This can be generalized to more than 2 files.
When files have a large size, the cat command is not convenient since the text scrolls very fast. The command ‘less’ displays the file content little by little.
rm as in Remove. This command removes files.
will remove the file ‘cv.tex’. We can also remove the contents of a directory:
will remove all files and subdirectories of the directory ‘analysis’ as well as the directory ‘analysis’ itself.
rmdir as in Remove Directory. This command removes empty directories.
To sum up, you will find below an index of the commands we have seen so far. Click on any of them to be directed to the explanation.
Index
If you found this post or this website helpful and would like to support our work, please consider making a donation. Thank you!
Help Us