In our previous session we have seen what is Linux and history of Linux
In today’s session we shall see what is a Linux Shell, Linux Architecture & Linux Directory Structure.
Shell is a user program
Shell is a environment provided for user interaction. Theoretically speaking Shell is a language interpreter that executes commands read from the standard input device (keyboard) or from a file.
In simple terms we can say that shell is the interface between the user and the kernel. it translates or what we can call….that it interprets all the commands typed by the user to the kernel
The kernel after processing the commands gives back the output to the shell.
Linux System Architecture consists of:
- Hardware layer – Hardware consists of all peripheral devices or called a physical devices( HDD/ CPU /RAM etc).
- Kernel – Core component of Operating System, interacts directly with hardware, is an application interface between programs and physical device( Hardware)
- Shell – An interface to kernel, hiding complexity of kernel’s functions from users. it is the interface between the user and the kernel
- User Applications – operating systems applications execution performed my various users to perform its task, like vi, mkdir,cd, grep, date, g++, gcc, office suits etc.
When a user types or executes a command for performing any operation the request goes to the SHELL. The Shell further translates these input in human understandable form to machine language and then transfer the request to the kernel. The kernel receives the request from shell, processes the request and then displays the result on the screen. All these functions are performed by the kernel in a transparent manner.
Next we shall see the file system hierarchy or the Linux Directory Structure
top level dir –all dir will be present under it
/bin – This directory contains most non-privileged system commands such as ls, mkdir, rm, etc.
/boot – Contains the systems boot image, boot loader, and the kernel
/dev – Contains Symbolic links to system devices such as optical and removable drives
/etc – Contains all system configuration files and most configurations for installed packages
/home – Contains a directory for each user and contains profile information
/lib – Contains dynamic libraries and modules for the Linux system and installed packages
/lost+found – Directory for lost files. Every disk partition has a lost+found directory.
/media – Contains mount points for optical drives and removable media
Directory for mounting files systems on removable media like CD-ROM drives, floppy disks, and Zip drives.
The following directories, or symbolic links to directories, must be in /media,
if the corresponding subsystem is installed:
floppy Floppy drive (optional)
cdrom CD-ROM drive (optional)
cdrecorder CD writer (optional)
zip Zip drive (optional)
/mnt – Used as a location for mounted drives and shares
/opt – Contains user installed packages and custom software which are not handled by the system or package manager
/proc – An interface between the kernel and the system, useful for system diagnosis information
A special directory in a virtual filesystem. It contains the information about various aspects of a Linux system.
/root – The superuser (root) home directory
admin of the linux os root –super user
default home dir of root user
/sbin – Contains privileged commands that are usually run as superuser (root/sudo)
Contains administrative binary files. Commands such as mount, shutdown, umount, reside here.
/srv – Contains data for services (HTTP, FTP, etc.) offered by the system.
/sys – A special directory that contains information about the devices, as seen by the Linux kernel
An interface between the kernel and the system, used for modifying system settings
/tmp – A location for temporary files such as sessions on a web server
Temporary directory which can be used as a scratch directory (storage for temporary files). The contents of this directory are cleared each time the system boots.
/usr – Contains most installed packages that are not part of the system, user installed programs
Contains subdirectories for many programs such as the X Window System.
/usr/bin – Contains commands related to user installed packages in /usr
/usr/sbin – Contains privileged commands related to user installed packages in /usr
/var – Contains various system files such as log, mail directories, print spool, etc. which tend to change in numbers and size over time.
Contains files that change often or accessed frequently
/var/log – Contains all system logs and most logs generated by installed packages which are very useful in diagnosing system issues ( a must know for system admins)