What is Linux? Now-a-days various operating systems are available in market and being used in various computers but most widely used are Linux and Windows.
What is Linux ?
Linux is an open source, multi-user, multi-tasking computer operating system designed primarily for the PCs. It was first developed by Linus Benedict Torvalds in the year 1991.
Linux was designed considering Unix compatibility. It’s functionality list is quiet similar to that of Unix. It can be considered in every sense as a full blown implementation of UNIX. But it cannot be called as UNIX because UNIX is a registered trademark product owned by AT&T (American Telephone and Telegraph). Linux is distributed as a free software under a free software licence called the GNU General Public Licence (GPL).
Linux is a 32 bit operating system. It runs on a wide variety of platform such as Intel, Sparc, Alpha, etc. One of the most valued advantage of Linux over the other platforms lies with the high security levels it ensures. It is a virus free operating system.
Basic elements of LUNIX
The basic elements of Linux are discussed in the following sub sections:
The kernel is at the core of LINUX system and is loaded into the memory as soon as the system starts up. It manages main memory, files and peripheral devices. Maintaining the time and date, launching applications, and allocating system resources are also functions of this part of the operating system.
It is a program that provides interface between user and kernel. It is used for executing the commands.The command can be either typed in through the command line or contained in a file called ‘shell script’. Commands in ‘shell script’ files are interpreted by the shell. It is also called command interpreter. It also provides a special interpreter program which can be used to execute commands of the operating system. It can be used to do various types of operations, call application program etc.
Linux treats everything as file. Even a directory is treated as a file that contains entries for several other files. All the hardware devices, such as (Input/Output) I/O devices, storage devices, etc., are all treated as files. File system is a logical way to describe the collection of storage available to the computer. In linux, file system mostly based on hierarchical structure. The upper most directory is known as root directory. It is expressed with a forward slash (/). All the files and directories are connected to root directory.
/bin This directory contains executable program files (binary files). In this directory, one can find the files for the Linux commands.
/dev This directory contains the special device files. For example, the printer may be a file known as prn in this directory, the hard disk may be hda file and its first partition would be hda0.
/etc This directory contains all the system-wide configuration information as text files.
/lib This directory contains the library files. Library files contain the reusable functions and routines for the programmer to use.
/tmp This directory contains all the temporary files, which will eventually be deleted from the system.
/usr This directory contains the home directories of the users, source text for the online manual (man) pages, games and other directories. There is one home directory for each user.
/kernel This directory contains all the kernel specific code. Kernel is the heart of the Linux system. It is responsible for resource allocation, security and low-level hardware interfaces.
/mnt This is the directory where the storage devices other than hard disks (floppy disks and CD disks) are mounted. This directory contains the sub-directories ‘floppy’ and ‘cdrom’ which when these devices are mounted show the contents of the CD-ROM or floppy disk, respectively.
/home This directory contains your personal configuration files.
Linux transparently supports many different filesystems, such as MSDOS, Minix, VFAT (Virtual File Allocation Table), PROC, ISO9660, EXT2, etc. Transparently, it means all of the mounted file systems and files appear as a single hierarchical virtual file system to the user. Users need not know what type of file or file system they are using. The files in floppy disks, compact disks, etc., all form part of this virtual file system.
Terminology related to file system are:
- Partition of a disk is a logical division of the collection of storage devices into independent units.
- Directory is a user specified location that allows user to organise files.
- File is the basic unit of storage in the logical file system.
- Path is a description of how to reach a particular file or directory.
- Inode is a data structure stored in the file system that identifies the file and its attributes.
- Link is a combination of a file’s name and the inode number that represent the file.
A Linux command is a series of characters that you type. These characters consist of words which are separated by white spaces. The first word is the command itself and the rest are the command’s arguments. These arguments provide information that the command may need for its execution. Linux commands are case-sensitive. That is, cp is different from CP and cP.
Commands are issued to the shell at the command line. A command line comprises of commands, the line of instructions, options and any command-line arguments that you may provide.
Commands are entered at the shell prompt ($, #). Prompt is merely a symbol that appears at the start of a command line. This lets the operator know that Linux is ready and waiting for your command.
Basic Commands of Linux
|cd||To change the current directory||$ cd ashok or $ cd/home/astha/dir/|
|cp||To copy a file||$ cp myfile astha|
|clear||To clear the screen||$ clear|
|cat||To concatenate and see the contents of file||$ cat [data 1] or $ cat [file 1] [file 2]|
|chmod||To change the file accept permission||$ chmod 777 myfile here, 777 means, rwxrwxrwx|
|date||To see date and time||$ date|
|echo||To show message on screen||$ echo this is a message or $ echo $ home|
|mkdir||To make new directories||$ mkdir my-dir or $ $mkdir/usr/pension/family|
|mv||To move or rename a file||$ mv astha ashok or $mv/ashok/home/pension/family|
|more||To quickly view a text file or any section of it||$ more ashok|
|man||It formats and displays the online manual pages||$ man cp|
|mkfs||Tu format some disk or floppy||$mkfs/dev/hdab|
|pwd||To view the full name of current directory||$ pwd/home/pension|
|rmdir||To remove the directory||$ rmdir my-dir|
|rm||To remove a file||$ rm *.* (to remove all files) or $ rm ashok|
|sort||To sort the contents of file||$ sort < ashok> ashok|
|tr||Translate squeeze and/or delete characters from standard input, writing to standard output||$tr”Agra kanpur” <astha> ashok|
|wc||To count words, lines or symbols in a file||$wc ashok|
|who||To view the name of users currently logged on||$ who|
|1s||To view the list of files||$15 or $1s ashok|
Device drivers are software packages that form a major part of the kernel. They control the interaction between the hardware devices and the operating system.
Utilities are software tools that are included with the Linux operating system and lets you do miscellaneous jobs, such as text editing, programming and communications.
File Handling in LINUX
Each directory or file in Linux is referred to, by using its pathname beginning from the root directory. For example, the directory usr is referred to as /usr (/ or root is its parent directory); mini is referred to as /usr/mini, where usr is the parent directory of mini directory.
There are two types of pathnames. These are
- Absolute Pathname
- Relative Pathname
Absolute Pathname: An absolute pathname tells you the complete path of a directory starting from the root, as explained above. Root is represented by a forward slash (/). For example, absolute pathname of “Delhi” directory is /usr/mini/sales/north/Delhi.
Relative pathname: Relative pathname gives location of a directory, relative to the current working directory For example, suppose your current working directory is /usr/mini/sales/north. Then the relative pathname to the ‘Delhi directory is Delhi. Relative pathnames do not start with a ‘/’. If you do not start a pathname with ‘/’, Linux assumes that you are using relative pathname.
Advantages of Linux
Following are the advantages of Linux operating system:
- Portable It can work on different types of hardware in same way.
- Open Source Linux source code is freely available.
- Multi-User Linux is a multi-user system i.e. multiple users can access system resources like memory/RAM/ application programs at same time.
- Multi-Programming Linux is a multi- programming system which means multiple applications can run at the same time.
- Hierarchical File System Linux provides a standard file structure in which system files/user files are arranged.
- Security Linux provides user security using authentication features like password protection/ controlled access to specific files/encryption of data.
Disadvantages of Linux
Following are the disadvantages of Linux operating system:
- Some hardware and software may not be compatible with a particular version of Linux.
- Linux require a strong learning curve to understand, as all the commands are to be learned with syntax.
- Installation and uninstallation of softwares is slightly tough task.
- It is a case sensitive operating system, i.e commands should be written with concentration.
Installation of Linux
Here, the installation of Red hat Linux 7.2 will be discussed. Before listing the procedures to follow for installing the Linux operating system, let us see what are the hardware and software requirements of Linux.
Red Hat Linux can be installed if the following basic hardware requirements are met:
- x86 platform namely 80386, 80486, etc.
- Intel, Sparc, Alpha or AMD (Advanced Micro Deviced) processor
- x386 CPU family or above
- Minimum 1 GB RAM
- Minimum 2 GB free hard disk space
- Input devices, such as keyboard, mouse etc
- Controller cards, such as SCSI (Small Computer System Interface), IDE (Integrated Development Environment), Firewire, etc.
- A Network card, such as ISA (Industry Standard Architecture), PCI (Peripheral Component Interconnect) or USB, etc.
- Sound card compatible to Linux
Software requirements for Linux installation are listed as follows:
- A partitioning program, such as fdisk or disk druid supplied by Red Hat.
- Linux Software package.
- Operating system.
In order to install the software, you first need to create installation disk.
Create Installation Disk
To create installation disk of Linux, following steps are performed:
- Insert and mount the CD-ROM and insert a blank floppy in floppy drive.
- Copy the following command
#dd it mnt/cdrom/images/boot.img of=/dev/Fd0 bs = 1440K on command prompt and press enter.
- Now, boot the computer with the help of any one of the following methods:
- a floppy installation disk
- DOS command line
- a network using FTP or HTTP protocols
- in partition of hard drive to hold installation software.
Partitioning of Hard Disk
A hard disk must be partitioned taking into consideration the present and future requirements. For example, let us consider that we have a given hard disk of 40 GB capacity.
Hard disk is divided in following partitions for Linux system:
- /swap directory About double of the RAM size.
- /roots directory About 60% of the available space.
- /bin directory About 20% of the available space.
- /usr directory Remaining space of disk.
The size of /usr should be the largest one. This is because all the users’ directories and files, installed application softwares, web pages, log files, etc., will be stored here.
Booting a LINUX system
The general booking procedure involves checking of the basic sub-systems of your computer, such as amount and validity of RAM, CPU time and speed, presence of floppy, CD-ROM or hard drive and keyboard and other attributes. The Linux may fail to boot if it detects a hardware failure, missing hardware or hardware misconfiguration.
Next, the BIOS will look for the bootable disk, in the order given in the settings (such as search floppy first, then CD-ROM and then the hard drive). Following this, it will look for the boot code in the Master Boot Record (MBR) of the first hard disk. This area of the disk (MBR) contains the boot sector, which loads boot loader (viz. LILO GRUB or BootMagic).
When the Linux kernel is loaded, the kernel will carry out the following:
- Initialize and load a RAM disk image.
- Perform timing tests.
- Parse for any boot time kernel arguments.
- Recognize, setup and initialize the CPU.
- Set up kernel memory and process handling.
- Open a console for displaying kernel boot messages.
- Initialize configured system devices.
- Start memory handling (paging, etc.).
- Set up and mount the file system.
- Start the init command.
The entire sequence of events that takes place when the LINUX kernel is loaded can be found in the file usr/src/linux/init/main.c
If all goes well, you will see a ‘login’ prompt. You can now login using your username and password.