0% found this document useful (0 votes)
21 views66 pages

Introduction to Linux Operating System

Uploaded by

Abhishek Bhalla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views66 pages

Introduction to Linux Operating System

Uploaded by

Abhishek Bhalla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT-1

 Linux is a community of open-source Unix like operating systems that are based on
the Linux Kernel.
 It was initially released by Linus Torvalds on September 17, 1991.
 It is a free and open-source operating system and the source code can be modified
and distributed to anyone commercially or non-commercially under the GNU General
Public License.
 Initially, Linux was created for personal computers and gradually it was used in other
machines like servers, mainframe computers, supercomputers, etc.
 Nowadays, Linux is also used in embedded systems like routers, automation controls,
televisions, digital video recorders, video game consoles, smartwatches, etc.
 The biggest success of Linux is Android(operating system) it is based on the Linux
kernel that is running on smartphones and tablets. Due to android Linux has the
largest installed base of all general-purpose operating systems. Linux is generally
packaged in a Linux distribution.
 Linux distribution is an operating system that is made up of a collection of
software based on Linux kernel or you can say distribution contains the Linux
kernel and supporting libraries and software.
 One can get Linux based operating system by downloading one of the Linux
distributions and these distributions are available for different types of devices
like embedded devices, personal computers, etc.
 Around 600 + Linux Distributions are available and some of the popular Linux
distributions are:
MX Linux Debian Manjaro
Linux Mint Deepin Redhat
Ubuntu Garuda Linux
Elementary EndeavourOS
Fedora Linux
openSUSE
 LINUX stands for Lovable Intellect Not Using XP.
 Linux was developed by Linus Torvalds and named after him.
 Linux is an open-source and community-developed operating system for
computers, servers, mainframes, mobile devices, and embedded devices.
 Linux receives requests from system programs and it relays them into
computer hardware.
 Linux is flexible, reliable, secure and it has large community user’s
support.
 Linux is compatible with almost every possible file format and can run on
a large number of devices.
 Events Leading to the Creation of Linux
 The emergence of Linux, one of the world’s most widely used open-source
operating systems, can be traced to several important events and the work of a
few people. Below is a summary of the major events that led to the emergence
of Linux.
 Unix development: Linux was heavily influenced by the Unix operating system
developed by Bell Labs in the late 1960s and early 1970s by Ken Thompson.
Unix was developed as a multi-user, multi-tasking operating system and has
been widely used in science and research.
 Minix is born: In the early 1980s, computer science professor Andrew S.
Tanenbaum created a small Unix-like operating system called Minix. Minix was
developed as an educational tool and the source code was made available to
students.
 Linux is born: In 1991, a 21-year-old student named Linus Torvalds began
working on a new operating system he named Linux. Linus was inspired by his
Minix and used its source his code as a starting point for his own projects. He
also drew heavily on Unix design principles.
 A popular open-source operating system is Linux.
 It was initially created by Linus Torvalds in 1991.
 At the time, Torvalds was a computer science student at the University of
Helsinki, Finland and began working on the Linux project as a personal
endeavour.
 The name Linux is a combination of his first name, Linus, and Unix, the
operating system that inspired his projects.
 At the time, most operating systems were proprietary and expensive.
 Torvalds wanted to create an operating system that was freely available to
anyone who wanted to use the operating system.
 He originally released Linux as free software under the GNU General Public
License. This meant that anyone could use, modify, and redistribute his
source code.
 Release of Linux 0.01: In September 1991, Linus released the first version of his
Linux called Linux 0.01. It was a command-line operating system and was freely
distributed on the Internet.
 Linux community development: In the years that followed, Linux quickly gained
popularity among programmers and enthusiasts. A community of developers
began to form around Linux, contributing to the development of the operating
system by writing code, filing bug reports, and providing feedback.
 Enterprise Adoption: In the late 1990s and early 2000s, the open-source nature
of Linux made it more flexible, cost-effective, and more secure than proprietary
operating systems such as Windows, making it a popular choice for enterprises
and businesses. started being hired by companies. This increased acceptance led
to the development of commercial support and services for Linux.
 Linux Distribution Growth: As Linux became more popular, various groups
of developers began creating their own versions of the operating system,
called distributions. Some of the most popular distributions are Red Hat,
Debian, and Ubuntu. These distros contain the Linux kernel and a number of
his packages of easy-to-use tools and software that make using his Linux
easy for both developers and end users.
 Linux in the Enterprise: With the growth of cloud computing and the
Internet of Things, Linux continues to gain traction in the enterprise. Linux
is now widely used as an operating system for servers, mainframes, and
supercomputers. It’s also used in embedded systems, mobile devices, and
the Internet of Things.
 Linux in the Consumer Market: Linux has also entered the consumer
market with the advent of Linux-based mobile devices, smart TVs, and other
consumer electronics.
 The official Linux mascot is a penguin named Tux.
 Created by artist Larry Ewing in 1996, the penguin was first used as his Linux
mascot for the Linux kernel.
 Tux quickly became popular in the Linux community and is now one of
Linux’s most recognizable icons.
 Tux was chosen as the mascot because the penguin is a rare animal found in
the wild in Antarctica, just as Linux is a unique and powerful operating
system.
 The name Tux comes from the short form “Torvalds Unix“, in honor of the
creator of Linux, Linus Torvalds.
 The Linux ecosystem is a constantly evolving and expanding platform, so there is a lot
of development going on. Notable recent developments include:
 Linux 5.11 kernel release. It includes new features such as AMD Zen 3 processor
support, memory management system improvements, and new hardware support.
 Continued development of various Linux distributions. Ubuntu 21.04 released in April
2021. It features an updated Gnome desktop environment, improved ZFS file system
support, and new security features.
 Development of new open-source software and tools for Linux. For example, the
release of version 6.0 of Ansible automation tools brings new features such as
support for Windows Subsystem for Linux 2 (WSL2) and improved support for
Kubernetes.
 The rise of containerization and orchestration technologies such as Docker and
Kubernetes. They are becoming more and more common in deploying and managing
Linux-based applications.
 Linux is growing in popularity in the cloud computing space, with many major cloud
providers offering Linux-based virtual machines and managed services.
 In 80’s, Microsoft’s DOS was the dominated OS for PC
 Apple MAC was better, but expensive
 UNIX was much better, but much, much more expensive. Only for
minicomputer for commercial applications
 People were looking for a UNIX based system, which is cheaper
and can run on PC
 Both DOS, MAC and UNIX were proprietary, i.e., the source code of
their kernel is protected
 No modification is possible without paying high license fees
 Established in 1984 by Richard Stallman, who believes that software
should be free from restrictions against copying or modification in
order to make better and efficient computer programs

• GNU is a recursive acronym for “GNU's Not Unix”


• Aim at developing a complete Unix-like operating
system which is free for copying and modification
• Companies make their money by maintaining and
distributing the software, e.g. optimally packaging the
software with different tools (Redhat, Slackware,
Mandrake, SuSE, etc)
• Stallman built the first free GNU C Compiler in 1991.
But still, an OS was yet to be developed
BEGINNING OF LINUX
 A famous professor Andrew Tanenbaum developed Minix, a simplified version of
UNIX that runs on PC
 Minix is for class teaching only. No intention for commercial use
 In Sept 1991, Linus Torvalds, a second year student of Computer Science at the
University of Helsinki, developed the preliminary kernel of Linux, known as Linux
version 0.01
Message from Professor Andrew Tanenbaum
" I still maintain the point that designing a monolithic kernel in 1991 is
a fundamental error. Be thankful you are not my student. You would
not get a high grade for such a design :-)“
(Andrew Tannenbaum to Linus Torvalds)

Soon more than a hundred people joined the Linux camp. Then thousands.
Then hundreds of thousands
It was licensed under GNU General Public License, thus ensuring that the
source codes will be free for all to copy, study and to change.
 no networking
 ran only on 80386 compatible Intel Processors and PC hardware
 limited device driver support
 Virtual memory subsystem was very basic
 Shared pages with copy-on-write
 Supported only Minix file system
 Released in March 1994
 Networking (supported TCP/IP, BSD compatible socket interface)
 Device driver support for running IP over Ethernet
 Enhanced file system not just restricted to Minix
 Virtual memory subsystem supporting paging to swap files and
memory mapping
 Extra hardware support
 Further enhancements seen in version 1.1, 1.2,1.3
 Released in June 1996
 Support for multiple architectures
 Support for multiprocessor architecture
 Memory management code improved to provide a unified cache for
file system data independent of the caching of block devices. Thus
increased file system and virtual memory performance.
 Improved TCP/IP performance and support to other protocols
 Support for internal kernel threads for handling loadable modules
LINUX TODAY
 Linux has been used for many computing platforms
– PC, PDA, Supercomputer,…
 Not only character user interface but graphical user interface is
available
 Commercial vendors moved in Linux itself to provide freely distributed
code. They make their money by compiling up various software and
gathering them in a distributable format
– Red Hat, Slackware, etc
LINUX - FREE SOFTWARE
 Free software, as defined by the FSF (Free Software Foundation), is
a "matter of liberty, not price." To qualify as free software by FSF
standards, you must be able to:
 Run the program for any purpose you want to, rather than be
restricted in what you can use it for.
 View the program's source code.
 Study the program's source code and modify it if you need to.
 Share the program with others.
 Improve the program and release those improvements so that
others can use them.
 When programmers on the Internet can read, redistribute, and modify the
source for a piece of software, it evolves
 People improve it, people adapt it, people fix bugs. And this can happen at
a speed that, compared to conventional software development, seems
astonishing
 The Architecture Of Operating system consist of 5 parts:-
Shell
Kernel
System Utilities
User Applications
Hardware Platform
 Kernel is the core of the Linux based operating system.
 It act as an interface between operating system and other hardware resources.
 It is the main part of the operating system that loads firsts and remains in the main
memory.
 It is the bridge between the application and the actual data processing to support the
application.
 It is responsible for task management, memory management and disk management .
 Its primary function is to manage the computer resources and support other program
who want to use these resources.
 Different types of the kernel are:
 Monolithic Kernel
 Hybrid kernels
 Exo kernels
 Micro kernels
 It acts as an interface between user and the operating system.
 It is a software that provides an interface for user of an operating
system which need services of a kernel.
 The shell is the utility that processes your requests. When you type in
a command at your terminal, the shell interprets the command and
calls the program that you want. So basically, you communicate with
the kernel through this program.(It is an interface to the kernel which
hides the complexity of the kernel’s functions from the users. It takes
commands from the user and executes the kernel’s functions. )
 An operating system shell is divided into two parts:-
Command line
GUI
 Command line Shell
 It is the part of the operating system which receives and executes the operating
system command by the user.
 The commands are then send to the kernel for execution.
 If the command is valid the kernel starts the execution else error will be produced.

 GUI (Graphical User Interface)


 This provides a user friendly environment.
 User cannot remember the syntax of all the command thus it help to simply point
toward the object by the mean or mouse or some other pointing device which a user
required for its execution.
 When user give command for performing any operation the request goes to the
SHELL.
 The Shell then translates these human program 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 in a transparent manner.
 NOTE:(A shell is basically an interface present between the kernel and the user. A
kernel is the very core of a typical OS. A shell is a CLI (command-line interpreter). A
kernel is a type of low-level program that has its interfacing with the hardware on
top of which all the applications run (disks, RAM, CPU, etc.).)
 Utility programs that provide the user most of the functionalities of an
operating systems.
 It is responsible for doing specialized level and individual activities.
 Utilities are software programs that add functionality to your computer or help
your computer perform better. These includes antivirus, backup, disk repair,
file management,security,and networking programs.
 An application program makes a system call to get the operating system to perform a
service for it, like reading from a file.

 A system call is how a program requests a service from an operating system's kernel.
This may include hardware related services (e.g. accessing the hard disk), creating
and executing new processes, and communicating with integral kernel services (like
scheduling). System calls provide an essential interface between a process and the
operating system.

 System calls can also be viewed as clearly-defined, direct entry points into the kernel
through which programs request services from the kernel. They allow programs to
perform tasks that would not normally be permitted.

 eg. A user has requested to MS paint. This request will be sent to the operating
system, and then the operating system will generate some activity to support MS
paint and run on the system.
 File Management System call – For performing open, close, read, write etc
operations.
 Process Control System Call – For performing Load, execute, create etc
operations.
 Device Management System Call – For performing request device, write
device, release device etc operations.
 Communication System call – For performing Send message, transfer
status operations etc.
 These are the applications which a user uses to perform his task.
 Linux and other operating system come up which various different
application in it
 Kernel is used to generate processes to support these applications.
 Linux operating system contains a hardware layer that consists of
several peripheral devices like CPU, HDD and RAM.

 These libraries can be specified as some special functions. These are applied
for implementing the operating system's functionality and don't need code
access rights of the modules of kernel.
 Types of Kernel
 Linus Torvalds introduced the concept of a monolithic kernel in 1991 as a part of
the Linux kernel. A monolithic kernel is a single large program that contains all
operating system components. However, the Linux kernel evolved over the years
and now consists of different types of kernels, as listed below.
 1. Monolithic Kernel As the name suggests, a monolithic kernel is a single large
program that contains all operating system components. The entire kernel executes
in the processor’s privileged mode and provides full access to the system’s
hardware. Monolithic kernels are faster than microkernels because they don’t have
the overhead of message passing. This type of kernel is generally used in
embedded systems and real-time operating systems.
 2. Microkernel A microkernel is a kernel that contains only the essential
components required for the basic functioning of the operating system. All other
components are removed from the kernel and implemented as user-space
processes. The microkernel approach provides better modularity, flexibility, and
extensibility. It is also more stable and secure than monolithic kernels.
 3. Hybrid Kernel A hybrid kernel is a kernel that combines the best features of both
monolithic kernels and microkernels. It contains a small microkernel that provides the
essential components for the basic functioning of the OS. The remaining components are
implemented as user-space processes or as loadable kernel modules. This approach
provides the best of both worlds, namely, the performance of monolithic kernels and the
modularity of microkernels.
 4. Exokernel An exokernel is a kernel that provides the bare minimum components
required for the basic functioning of the operating system. All other components are
removed from the kernel and implemented as user-space processes. The exokernel
approach provides the best possible performance because there is no kernel overhead.
However, it is also the most difficult to implement and is not widely used.
 There are four shells that are commonly supported by UNIX vendors:
 the Bourne shell(sh), the Korn shell(ksh), the C shell(csh) and Bourne
Again Shell (bash).

 In the next segment, we will study Bash (Bourne Again Shell) that is
compatible with Bourne shell and borrows best features from the other
shells. Bash is becoming the most popular shell - it is the default shell
in Linux.
 SELECTING A SHELL

 When you are provided with a UNIX account,the system administrator chooses
a shell for you.

 To find out which shell was chosen for you, look at your prompt.

 If you have a $ prompt, you’re probably in a Bash, Bourne or a Korn shell.

 If you have a % prompt, you’re probably in a C shell.


 Utility : chsh

- chsh allows you to change your default login shell.


It prompts you for the full pathname of the new shell,
which is then used as your shell for subsequent logins.

- In order to use chsh, you must know the full pathnames


of the three shells. Here they are:

Shell Full Pathname


Bourne /bin/sh
Bash /bin/bash
Korn /bin/ksh
C /bin/csh

36
The Bourne Shell –
Denoted as sh
It was written by Steve Bourne at AT&T Bell Labs.
It is the original UNIX shell. It is faster and more preferred.
It lacks features for interactive use like the ability to recall
previous commands.
It also lacks built-in arithmetic and logical expression handling.
The GNU Bourne-Again Shell (Bash)
The Bourne-Again shell is an updated version of the original
Bourne shell that was created by the Free Software Foundation for
its open source GNU project. For this reason, it is a widely used
shell in the open source community.
Its syntax is similar to that used by the Bourne shell, however it
incorporates some of the more advanced features found in the C,
TC and Korn shells.
Bash provides a range of features, including command history, tab
completion, and scripting.
 It is also highly customizable and can be configured to suit
individual needs.
 The popularity of sh motivated programmers to develop a shell that was compatible
with it, but with several enhancements.
 Linux systems still offer the sh shell, but "bash" -- the "Bourne-again Shell," based on
sh -- has become the new default standard.
 One attractive feature of bash is its ability to run sh shell scripts unchanged.
 Shell scripts are complex sets of commands that automate programming and
maintenance chores; being able to reuse these scripts saves programmers time.
C Shell
C shell, also known as csh, is a shell that is popular among
programmers and developers.
 Itincludes many features designed to make programming and
development tasks more efficient.
The C shell was created at the University of California by Bill Joy.
It was developed to include useful programming features like in-built
support for arithmetic operations and a syntax similar to the C
programming language.
Further, it incorporated command history which was missing in
different types of shells in Linux like the Bourne shell. Another
prominent feature of a C shell is “aliases”.
C shell includes advanced command history, job control, and advanced
scripting capabilities.
Ken Greer, working at Carnegie-Mellon University, took csh concepts a
step forward with a new shell, tcsh, which Linux systems now offer.
T Shell
Tcsh is an upgraded C shell. This shell can be used as a shell
script command processor and interactive login shell.
Tcsh shell includes the following characteristics:
 C like syntax
 Filename completion and programmable word
 Command-line editor
 Job control
 Spelling correction
Korn shell
 The Korn shell was developed at AT&T Bell Labs by David Korn, to improve the
Bourne shell.
 It is denoted as ksh.
 The Korn shell is essentially a superset of the Bourne shell.
 Besides supporting everything that would be supported by the Bourne shell, it
provides users with new functionalities.
 It allows in-built support for arithmetic operations while offering interactive
features which are similar to the C shell.
 The Korn shell runs scripts made for the Bourne shell, while offering string, array
and function manipulation similar to the C programming language.
 It also supports scripts which were written for the C shell. Further, it is faster
than most different types of shells in Linux, including the C shell.
 Fundamental Architecture of Linux
The fundamental architecture of Linux is divided into main two
parts:
User Space
Kernel Space
 1. User Space:
 The User Space is the domain where user applications and processes operate.
 It is the area where most user-level programs, such as software applications and
utilities, execute.
 User Space does not have direct access to memory or hardware.
 It connects to the hardware via kernel space.
 User-space processes or programs can only access some parts of memory via
system calls.
 Crashes in user mode are recoverable due to complete protection.
 The GNU C library in the user space provides the mechanism for switching user
space applications to the kernel space.
 2. Kernel Space:
 The Kernel Space, also referred to as the System Space, is a privileged domain
dedicated to the execution of kernel programs.
 It includes all the memory and facilitates interaction with hardware components
such as RAM and hard disks.
 Within the Kernel Space, different blocks and modules handle various
operations essential to the operating system, including file management,
memory management, and process management.
 The Kernel Space includes components such as the system call interface,
the kernel itself (the core component of Linux), and device modules.
Architecture of Kernel
 The architecture of a kernel follows a modular approach. It consists of several
components that work together to manage system resources and facilitate
communication between different parts of the operating system. The following
are the core Subsystems of the Linux Kernel:
 The Process Scheduler
 The Memory Management Unit (MMU)
 The Virtual File System (VFS)
 The Networking Unit
 Inter-Process Communication Unit
 The Process Scheduler
 This is the primary subsystem of the kernel as it is responsible for distributing the CPU
time and resources among all the processes or applications in a fairway.
 Its purpose is to ensure that no process runs out of CPU resources, allowing multiple
applications to run simultaneously without affecting the performance of one.
 The process scheduler provides fairness, efficiency, and responsiveness by utilizing
various scheduling algorithms such as round-robin, priority-based, or multi-level
feedback queues.
 The Memory Management Unit (MMU)
 This kernel subsystem is responsible for managing and organizing the system's
memory resources.
 It is responsible for ensuring that memory is allocated and distributed appropriately
among multiple processes and applications, preventing issues such as crashes or
kernel mode errors caused by insufficient memory.
 By efficiently managing memory, this subsystem ensures that processes and
applications have access to the necessary memory resources and prevents memory-
related errors.
 The Virtual File System (VFS)
 The Virtual File System (VFS) subsystem inside the kernel is responsible for providing an
equal interface to all available filesystems on the computer and allowing them to access the
stored data on those file systems.
 It abstracts the details of different file systems, such as ext4, NTFS, or FAT, and provides a
consistent file I/O interface to user programs. Regardless of the underlying file system, the
VFS layer enables programs to do file-related actions such as opening, reading, writing, and
closing files.
 The Networking Unit
 The Networking Unit subsystem in the Linux kernel is an essential component located
within the kernel space.
 It plays a crucial role in facilitating communication between hosts, even if they are not
directly connected.
 In X-Windows, the network subsystem is used for client-server communication, allowing
applications to connect over a network. The Linux Kernel's networking stack handles
incoming packets, processing them from Layer 2 (data link layer) up to the network layer.
 Inter-Process Communication Unit
 The inter-process communication (IPC) unit facilitates communication and data sharing
between distinct operating system processes or threads.
 Linux supports a number of Inter-Process Communication (IPC) mechanisms. Signals and
pipes are two of them, but Linux also supports the System V IPC mechanisms, which are
named after the Unix TM release in which they were initially introduced.
 Multitasking: Several programs can run at the same time.
 Multiuser: Several users can logon to the same machine at the same
time There is no need to have separate user licenses.
 Multiplatform: Linux runs on many different CPUs, that means it
supports multiprocessor machine.
 Multithreading: Linux has native kernel support for multiple
independent threads of control within a single process memory
space.
• GUI – with x-windows 2 popular desktop environments GNOME and
KDE
• Shell – CLI to OS
• Hierarchical File System – Entire File system is tree structured and
anchored to a single directory root
• Robust Programming and Application Environments – C Complier,
C++, assemblers, Perl, Python are available in Linux
• Freedom – free to choose any distribution
• Compatible File, Device and Interprocess I/O – Redirection is
possible without changing the program
• •

• Crash proof: Linux has memory protection


between processes, so that one program can't
bring the whole system down.
•Demand loads executables: Linux only reads
from those parts of a program that are actually
used on the disk.
•Shared copy-on-write pages among
executables: This means that multiple
processes can use the same memory to run in.
When one tries to write to that memory, that
page (with 4KB piece of memory) is copied
somewhere else. Copy-on-write has two
benefits: increasing speed and decreasing
memory use.
• Virtual memory uses paging (not swapping whole processes) to disk to a separate
partition or a file in the file system, or both, with the possibility of adding more
swapping areas during runtime (yes, they're still called swapping areas). A total of 16 of
these 128 MB (2GB in recent kernels) swapping areas can be used at the same time, for a
theoretical total of 2 GB of usable swap space. It is simple to increase this if necessary,
by changing a few lines of source code.
•Linux has a unified memory pool for user programs and disk cache, so that all free
memory can be used for caching, and the cache can be reduced when running large
programs. (Buddy & slab cache)
• Linux does core dumps for post-mortem analysis, allowing
the use of a debugger on a program not only while it is
running but also after it has crashed.

• Linux is mostly compatible with POSIX, System V, and BSD


at the source level.

• Free and Open source code for all: All source code of Linux
is available, including the whole kernel and all drivers, the
development tools and all user programs; also, all of it is
freely distributable. Plenty of commercial programs are being
provided for Linux without source, but everything that has
been free, including the entire base operating system, is still
free.
• Linux supports pseudoterminals (pty's)
and multiple virtual consoles: By several
independent login sessions through the
console, you can switch between by pressing
a hot-key combination (not dependent on
video hardware). These are dynamically
allocated; you can use up to 64.
• Linux supports several common file systems, including minix,
Xenix, and all the common system V file systems, and has an
advanced file system of its own EXT2 EXT3, which offers file
systems of up to 4 TB, and names up to 255 characters long.

• Linux has a transparent access to MS-DOS partitions (or OS/2 FAT


partitions) via a special file system:.You don't need any special
commands to use the MS-DOS partition, it looks just like a normal
Unix file system (except for funny restrictions on file names,
permissions, and so on). MS-DOS 6 compressed partitions do not
work at this time without a patch (dmsdosfs). Also VFAT (WNT,
Windows 95) support and FAT-32 is available in Linux 2.0
 The main advantage of Linux, is it is an open-source operating system. This
means the source code is easily available for everyone and you are allowed to
contribute, modify and distribute the code to anyone without any
permissions.
 In terms of security, Linux is more secure than any other operating system. It
does not mean that Linux is 100 percent secure it has some malware for it
but is less vulnerable than any other operating system. So, it does not
require any anti-virus software.
 The software updates in Linux are easy and frequent.
 Various Linux distributions are available so that you can use them according
to your requirements or according to your taste.
 Linux is freely available to use on the internet.
 It has large community support.
 It provides high stability. It rarely slows down or freezes and there is no
need to reboot it after a short time.
 It maintain the privacy of the user.
 The performance of the Linux system is much higher than other operating
systems. It allows a large number of people to work at the same time and it
handles them efficiently.
 It is network friendly.
 The flexibility of Linux is high. There is no need to install a complete Linux
suit; you are allowed to install only required components.
 Linux is compatible with a large number of file formats.
 It is fast and easy to install from the web. It can also install on any
hardware even on your old computer system.
 It performs all tasks properly even if it has limited space on the hard disk.
 In Linux/Unix operating system everything is a file even directories are
files, files are files, and devices like mouse, keyboard, printer, etc are also
files.
 In a Windows-like operating system, files are stored in different folders on
different data drives like C: D: E: whereas in the Linux/Unix operating
system files are stored in a tree-like structure starting with the root
directory as shown in the below diagram.
 / - The Root Directory
 We can read the '/' as the root directory. It is the only Linux directory under which
all other files and directories reside. Only the root users get the privilege to write or
change the directory structure.
 In other words, the / is the starting point in the Linux directory structure.
 /root - Home Folders
 The /root is the user's home directory & is not the same as /. Both are different.
 Root account is the system admin, superuser or root user.
 It has complete access to Linux system files and commands.
 /home
 In the Linux directory structure, each user gets a home directory, which is the user's
directory.
 This directory holds user-specific configuration files and other user data.
 As a Linux user, you can put all your files, programs, notes, etc., in this home
directory.
 When a system administrator creates a user account on the Linux system, it is a good
practice to create a home directory for that user.
 /bin - Essential User Binaries
 The /bin is another popular directory that contains necessary user binaries.
 In other words, it holds the executable files of numerous basic shell commands like
cp, ls, cd, and other such commands. Since these executable programs remain in
binary format, they reside in this directory.
 /etc - Configuration Files
 All the system's core configuration file resides in this directory.
 The system administrator & various other internal core services like the networking
or password files use configuration files from here. If the admin wants to configure
the system in any way (for example: changing the hostname) they would have to
work with config files located in this directory.

 /opt - Optional Packages


 Linux also leverages a lot of optional software packages. For these, there is a
separate directory in the Linux directory structure.
 Usually, the /opt directory helps install & store the files of various third-party apps.
In other words, all proprietary software that does not obey the standard Linux file
system hierarchy gets piled up when installed.
 /tmp – Temporary Files
 Numerous applications and third-party software generate the temporary file(s) when they
start executing. Those temporary files reside in the /tmp directory.
 These files get deleted automatically when the user restarts the system or uses utilities
like "tmpwatch" to delete those temporary files after a fixed duration.
 /usr - User Binaries & Read-Only Data
 It is another important directory in the Linux directory structure. It contains various files
and apps that the user or the systems use.
 Secondary hierarchy for read-only user data; contains the majority of (multi-)user utilities
and applications.
 Contains binaries, libraries, documentation, and source-code for second level programs.
 /usr/bin contains binary files for user programs. If you can’t find a user binary under
/bin, look under /usr/bin. For example: at, awk, cc, less, scp
 /usr/sbin contains binary files for system administrators. If you can’t find a system
binary under /sbin, look under /usr/sbin. For example: atd, cron, sshd, useradd, userdel
 /usr/lib contains libraries for /usr/bin and /usr/sbin
 /usr/local contains user’s programs that you install from source. For example, when you
install apache from source, it goes under /usr/local/apache2
 /usr/src holds the Linux kernel sources, header-files and documentation.
 /var - Variable Data Files
 It is the writable counterpart of the /usr directory.
 It remains in read-only mode for normal operations.
 Various log files & any other files that get written to /usr during regular operation
reside within this directory.
 For example, apps or programs that create log files will remain stored in /var/log.
 /boot – Static Boot files
 the boot directory (/boot) holds specific files required for the system booting.
 For example, the GRUB bootloader & LILO, with some other booting files associated
with the boot image and Linux kernel, reside in this directory.
 /dev – device files
 It is the location of the device files such as dev/sda1, dev/sda2, etc. files that
represent hardware devices,HDD,terminals etc.
 Facilitates communication between operating system and hardware devices.
 System application communicates with standard device abstractions via input and
output system calls.
 /lib -Essential Shared Libraries
 Libraries are a collection of codes that other binary executables use to perform various
system-related tasks. All these library files reside in the /lib directory.
 It contains kernel modules and a shared system library.
 /lost + found - Recovered Files
 Each Linux directory structure has a lost+found directory.
 It is a critical Linux directory that stores corrupted files when your system crashes.
 If your file system crashes, the Linux operating system will perform a check at the next
boot. During boot-up, all the corrupt files will get stored in the lost+found directory. From
this directory, users can recover the majority of their data.
 /media - Removable Media
 It is a directory where various removable media devices like SD cards, USB disks, or DVDs
get mounted.
 All these removable media files reside as subdirectories within the /media directory.
 These subdirectories get created automatically.
 For instance, if you insert a CD into your CD-ROM, the media directory gets created
automatically. Within the /media's subdirectory, you can navigate the files stored in the
CD.
 /mnt-Temporary Mount Points
 used to mount file systems temporarily, such as network file systems or disk
images.
 It is similar to that of /media. The only difference is instead of automatically getting
mounted when the Linux encounters media files - the system administrator
manually does the mounting. For instance, if you wish to mount a Windows
partition for recovering operations, you will mount its files at /mnt/windows.
 /proc-Kernel & Process Files
 It is another popular directory under the Linux directory structure that holds details
and information about currently executing processes.
 It contains particular files that represent the system operations and various kernel
parameters.
 For instance, if you want to check your system's processor status, you can navigate
to the /proc/cpuinfo file. For memory-related information, you can navigate to
the /proc/meminfo. All these reside under the /proc directory.
 /run-Application State Files
 It is a comparatively new directory in the Linux directory structure.
 In this location, all the short-lived files that are generated or run for specific
purposes like process IDs or sockets get stored in this directory.
 Files under the /run directory are critical process files that other applications or
kernel use. So, we cannot hold them in the /tmp directory because the /tmp files
might get deleted.
 /sbin - System Administration Binaries
 It is another integral directory under the Linux directory structure similar to
the /bin directory.
 It contains essential binaries that the root or sudo user executes for system
administrations. We can consider the s in the sbin as super or sudo (super user do).
 /srv - Service Data
 Various service-related data associated with the system or kernel reside in this
directory. We often employ services like Apache server, HTTP server, etc., while
developing websites or other web applications. Storing such website data in these
directories is a good practice

You might also like