Introducation of Linux
What is Linux ?
Linux is a free open-source operating system based on Unix. Linus Torvalds originally created Linux with the assistance of developers from around the world. Linux is:
-> Free
-> Unix like
-> Open Source
-> Network operating System
-> Stable
-> Robust
-> Secure
-> High performance
It is excellent operating system for:-
-> Desktop computer
-> Web server
-> Software development workstation
-> Network monitoring workstation
-> Workgroup server
-> Killer network services such as DHCP, Firewall, Router, FTP, SSH, Mail, Proxy, Proxy Cache server etc.
History of Linux
In 1991, Linus Torvalds was studying UNIX at university, where he was using a special educational experimental purpose operating system called Minix (a small version of UNIX to be used in the academic environment). However, Minix had its limitations and Linus felt he could create something better. Therefore he developed his own version of Minix, known as Linux. Linux was Open Source right from the start. Linux is a kernel developed by Linus. The kernel was bundled with system utilities and libraries from the GNU project to create a usable operating system. Sometimes people refer to Linux as GNU/Linux because it has system utilities and libraries from the GNU project. Linus Torvalds is credited for creating the Linux Kernel, not the entire Linux operating system[1].
Linux distribution = Linux kernel + GNU system utilities and libraries + Installation scripts + Management utilities etc.
What is kernel ?
The kernel is the heart of the Linux operating system. Linux is not operating system. Linux is a kernel. A kernel provides access to the computer hardware and control access to resources such as:
-> File management.
-> Multitasking.
-> Memory management.
-> I/O management.
-> Process management.
-> device management.
-> Running programs.
-> Loading programs into memory.
-> Networks.
-> Security and firewall.
-> Other resources etc.
The kernel decides who will use these resources and for how long and when. It runs your programs or sets up to execute binary files. The kernel acts as an intermediary between the computer hardware and various applications.
What is Shell ?
Computers understand the language of zeros and ones known as binary language. In the early days of computing, instructions were provided using binary language, which is difficult for all of us to read and write. Therefore, in an operating system there is a special program called the shell. The shell accepts human readable commands and translates them into something the kernel can read and process.
In short :
-> It is a command language interpreter that executes commands read from the standard input device such as keyboard or from a file.
-> The shell is not part of system kernel, but uses the system kernel to execute programs, create files etc.
Several shells are available for Linux including:
BASH ( Bourne-Again SHell ) - Most common shell in Linux. It's Open Source.
CSH (C SHell) - The C shell's syntax and usage are very similar to the C programming language.
KSH (Korn SHell) - Created by David Korn at AT & T Bell Labs. The Korn Shell also was the base for the POSIX Shell standard specifications.
TCSH - It is an enhanced but completely compatible version of the Berkeley UNIX C shell (CSH).
Please note that each shell does the same job, but each understands different command syntax and provides different built-in functions. Under MS-DOS, the shell name is COMMAND.COM which is also used for the same purpose, but it is by far not as powerful as our Linux Shells are!
How do I find out my current shell name?
To find all of the available shells in your system, type the following command:
root@bhandari]# cat /etc/shells
In case the /etc/shells file has more than one shell listed under it, then it means that more than one shell is supported by your platform.
Command Line Interface (CLI)
The shell provides an interface to Linux where you can type or enter commands using the keyboard. It is known as the command line interface (CLI).
To find out your current shell type following command.
root@bhandari]# echo $SHELL
root@bhandari]# ps $$
root@bhandari]# ps -p $$
The following sample output indicate that I am using bash shell:
PID TTY TIME CMD
13931 pts/4 00:00:00 bash
Basic Command Line Editing
You can use the following key combinations to edit and recall commands:
CTRL + L : Clear the screen.
CTRL + W : Delete the word starting at cursor.
CTRL + U : Clear the line i.e. Delete all words from command line.
Up and Down arrow keys : Recall commands (see command history).
Tab : Auto-complete files, directory, command names and much more.
CTRL + R : Search through previously used commands (see command history)
CTRL + C : Cancel currently running commands.
CTRL + T : Swap the last two characters before the cursor.
ESC + T : Swap the last two words before the cursor.
CTRL + H : Delete the letter starting at cursor.
Getting Help In Linux
Most commands under Linux will come with documentation.
You can view documentation with the man command or info command. In this example, open the manpage for date command:
root@bhandari]# man date
You can read info documentation as follows for the ls command:
root@bhadnari]# info ls
Many commands accepts --help or -h command line option. In this example, display help options for the date command:
root@bhandari]# date --help
In short use any one of the following option to get more information about Linux commands:
man commandName
info commandName
commandName -h
commandName --help