Linux Introduction-Teams

Download as pdf or txt
Download as pdf or txt
You are on page 1of 22

Introduction to Linux

By
RAGHUDATHESH G P
Manipal School of Information Sciences
MAHE, Manipal
Linux operating system
What is Linux
 Linux is a Unix-like, open source and community-developed operating system (OS) for
computers, servers, mainframes, mobile devices and embedded devices.
 It is supported on almost every major computer platform, including x86, ARM and
Scalable Processor Architecture(SPARC), making it one of the most widely supported
operating systems.

How is the Linux operating system used


 Every version of the Linux OS manages hardware resources, launches and handles
applications, and provides some form of user interface.
 There is enormous community for developers and wide range of distributions, means that
a Linux version is available for almost any task, and Linux has penetrated many areas of
computing.

Where is the Linux operating system used


 Linux has emerged as a popular OS for web servers such as Apache, as well as for
network operations, scientific computing tasks that require huge compute clusters,
running databases, desktop and endpoint computing, and running mobile devices with
OS versions like Android.
 The Linux OS can be found in many different settings, supporting many different use
cases. Linux is used in the following ways:
1. Server OS for web servers, database servers, file servers, email servers and any
other type of shared server. Designed to support high-volume and multithreading
applications, Linux is well-suited for all types of server applications.
2. Desktop OS for personal productivity computing. Linux is an open source and
freely available desktop environment for users who prefer it to commercial OSes.
3. Headless server OS for systems that do not require a graphical user interface
(GUI) or directly connected terminal and keyboard. Headless systems are often
used for remotely managed networking server and other devices.
4. Embedded device or appliance OS for systems that require limited computing
function. Linux is used as an embedded OS for a variety of applications, including
household appliances, automotive entertainment systems and network file system
appliances.
5. Network OS for routers, switches, domain name system servers, home
networking devices and more. For example, Cisco offers a version of the Cisco
Internetwork Operating System (IOS) that uses the Linux kernel.
6. Software development OS for enterprise software development. Although many
development tools have been ported to Windows or other OSes, Linux is home to
some of the most widely used open source software development tools.
 Example, git for distributed source control; vim and emacs for source
code editing; compilers and interpreters for almost every programming
language.
7. Cloud OS for cloud instances. Major cloud computing providers offer access to
cloud computing instances running Linux for cloud servers, desktops and other
services.
 Linux is highly configurable and depends on a modular design that enables users to
customize their own versions of Linux. Depending on the application, Linux can be
optimized for different purposes such as:
 Networking performance;
 Computation performance;
 Deployment on specific hardware platforms; and
 Deployment on systems with limited memory, storage or computing resources.

Linux Distributions
 Since its initial development, Linux has adopted the copyleft stipulations of the Free
Software Foundation which originated the GNU GPL.
 The GPL says that anything taken for free and modified must be distributed for free.
In practice, if Linux or other GNU-licensed components are developed or modified to
create a new version of Linux, that new version must be distributed for free. This prevents
a developer or other groups from profiting unfairly from the freely available work of
others.
 Hundreds of different Linux versions, also known as distributions or distros, are
available. Distributions usually distinguish themselves from the pack by addressing a
specific goal, philosophy, function or target market. (https://distrowatch.com/)
 There are distributions tailored for specific target functions, such as servers, desktops,
gaming, security, or embedded devices including Raspberry Pi systems.
 Most modern distributions are precompiled and ready to use (Debian), while others
like Gentoo Linux consist of source code that a user can compile locally during initial
installation to optimize their system configuration.
 Knoppix Linux is one of many distros used to recover damaged hard drives
and perform other technical support tasks.
 Information security professionals use Kali Linux for penetration testing and
other security-related tasks.
 Linux has become an important component of automaker entertainment systems.
Many automakers have joined Automotive Grade Linux (AGL), an open source
project hosted by the Linux Foundation. For example, Toyota and Lexus
vehicles use AGL for their infotainment systems.
 Linux distributions may be community-developed, like Debian, Slackware and Gentoo.
Other distributions are commercial and intended for enterprise use, including Red Hat
Enterprise Linux and SUSE Linux Enterprise Server. Many distributions use a
combination of community- and corporate-supported development, such as Red
Hat's Fedora, openSUSE from SUSE and Ubuntu from Canonical.

Linux components and terminology


 The Linux OS system incorporates several different components, including:
 Bootloader:
 A bootloader is responsible for managing the boot process of the
computer and for starting the Linux kernel.
 It can also be used to manage systems that boot more than one OS.
 Kernel:
 The core of the Linux system, the kernel handles network access,
schedules processes or applications, manages basic peripheral devices and
oversees all file system services.
 The Linux kernel is the software that interfaces directly with the computer
hardware.
 Init system:
 The first process to run once the kernel is loaded. A process is an
instance of a program running on a computer, and the init system
initializes the system to enable it to run other processes.
 Init is a daemon program that acts as the parent process to all other
processes running on the system.
 Init can be configured to start specific processes at system
initialization.
 Example, when the system will be running a web server the init system
can be configured to load all necessary web server software.
 Daemons:
 This is a program that runs in the background, handling requests for a
service.
 A web server running on a Linux server depends on a daemon, usually
named httpd, to listen for web server requests.
 Graphical server:
 This is the software that controls how graphics are displayed on a
computer. Without a graphical server, users can only interact with the
Linux system through a command-line interface.
 The X Window System, also known as X11 or X, is the most common
graphical server for Linux, though not the only one.
 X runs as a server daemon on the system and is called upon by applications
when graphical output is required.
 Desktop environment:
 This is the collection of applications and user interface controls with
which users interact when using Linux as a desktop platform.
 Access to the desktop environment is usually controlled through the X
Window System or another graphical system. Each desktop environment
defines its own look, including the way graphical elements like windows,
pull-down menus and files are displayed and manipulated.
 The desktop environment will also include a set of default applications for
managing files and folders, text editing, running a command-line session
and other common tasks.
 The two most popular desktop environments are GNU Network Object
Model Environment (GNOME) and KDE.
 Applications:
 This is the software that is installed during and after the initial Linux
installation.
 Most Linux distributions include thousands of different applications,
including both for a networked server and for desktop use.
 Package manager
 Package manager software typically adds, updates or removes software
components under the Linux OS. Package managers enable users to install
additional software not included with their distributions.
 Examples of software package managers include RPM Package Manager,
dpkg, OpenPKG and Zero Install.

How the Linux operating system works


 The Linux OS follows a modular design that is the key to its many variations and
distributions. All Linux distributions are based on the Linux kernel, but they can
differ depending on factors such as:
 Kernel version:
 Distributions can be configured with more recent versions to incorporate
newer features or with older versions to be more stable.
 Kernel modules:
 This is software that can be loaded and unloaded into the kernel to extend
functionality without rebooting.
 Kernel modules are often used to support: device drivers, which use code
that controls how attached devices operate. File system drivers, which
use code that controls how the kernel works with different file systems;
and system calls, which use code that controls how programs request
services from the kernel.
 Configuration options:
 Linux kernels compiled with configuration options set to include only
device or file system drivers are used for some specialized
distributions; for example, compiling a kernel for a wireless device
without any wired network device drivers.
 The Linux kernel is the one thing that all systems running Linux have in common. Linux
works by:
 Loading and booting a Linux kernel.
 Once booted, the kernel manages all system input and output. The system is
initialized, and processes can be started.
 As system processes are started, the system can be used for processes that include
network server functions, commands entered interactively via command line,
desktop applications or any application or program.

The pros and cons of using Linux


 Some advantages of using Linux include:
 Open source software: The Linux kernel is released under the GNU GPL open
source software license. Most distros include hundreds of applications, with many
options in almost every category. Many distributions also include proprietary
software, such as device drivers provided by manufacturers, to support their
hardware.
 Licensing costs: Unlike Microsoft Windows or Apple macOS, Linux has no
explicit licensing fees. While system support is available for a fee from many
Linux vendors, the OS itself is free to copy and use. Some IT organizations have
increased their savings by switching their server software from a commercial OS
to Linux.
 Reliability: Linux is considered a reliable OS and is well-supported with security
patches. Linux is also considered to be stable, meaning it can run in most
circumstances. Linux also copes with errors when running software and
unexpected input.
 Backward compatibility: Linux and other open source software tend to be
updated frequently for security and functional patches, while retaining core
functionality. Configurations and shell scripts are likely to work unchanged even
when software updates are applied. Unlike commercial software vendors that roll
out new versions of their OSes along with new ways to work, Linux and open
source applications generally don't change their modes of operation with new
releases.
 Many choices: Between the hundreds of available distributions, thousands of
applications and almost infinite options for configuring, compiling and running
Linux on almost any hardware platform, it is possible to optimize Linux for
almost any application.
 Some disadvantages of using Linux include:
 Lack of established standard: There is no standard version of Linux, which may
be good for optimizing Linux for particular applications, but less so for deploying
standardized server or desktop images. The wide range of options can complicate
support as a result.
 Support costs: While an organization can acquire Linux freely without licensing
fees, support is not free. Most enterprise Linux distributors like SUSE and Red
Hat offer support contracts. Depending on the circumstances, these license fees
can reduce savings significantly.
 Proprietary software: Desktop productivity software like Microsoft Office
cannot be used on Linux desktops, and other proprietary software may be
unavailable for Linux platforms.
 Unsupported hardware: While many hardware manufacturers make Linux
device drivers available for their products, many do not.
 Steep learning curve: Many users struggle to learn to use the Linux desktop or
Linux-based applications.

Linux Boot Process (Startup Sequence)

Figure 0.1: Linux Boot Process


 The following are the 6 high level stages of a typical Linux boot process when you
press the power button on your system:
1. BIOS
 BIOS stands for Basic Input/Output System.
 Performs some system integrity checks.
 Searches, loads, and executes the boot loader program.
 It looks for boot loader in floppy, cd-rom, or hard drive. You can press a
key (typically F12 of F2, but it depends on your system) during the BIOS
startup to change the boot sequence.
 Once the boot loader program is detected and loaded into the memory,
BIOS gives the control to it.
 So, in simple terms BIOS loads and executes the MBR boot loader.
2. MBR
 MBR stands for Master Boot Record.
 It is located in the 1st sector of the bootable disk. Typically /dev/hda, or
/dev/sda
 MBR is less than 512 bytes in size. This has three components 1) primary
boot loader info in 1st 446 bytes 2) partition table info in next 64 bytes 3)
mbr validation check in last 2 bytes.
 It contains information about GRUB (or LILO in old systems).
 So, in simple terms MBR loads and executes the GRUB boot loader.
3. GRUB
 GRUB stands for Grand Unified Bootloader.
 If you have multiple kernel images installed on your system, you can
choose which one to be executed.
 GRUB displays a splash screen, waits for few seconds, if you don’t enter
anything, it loads the default kernel image as specified in the grub
configuration file.
 GRUB has the knowledge of the filesystem (the older Linux loader LILO
didn’t understand filesystem).
 Grub configuration file is /boot/grub/grub.conf (/etc/grub.conf is a link to
this). The following is sample grub.conf of CentOS.

#boot=/dev/sda
default=0

timeout=5

splashimage=(hd0,0)/boot/grub/splash.xpm.gz

hiddenmenu

title CentOS (2.6.18-194.el5PAE)

root (hd0,0)

kernel /boot/vmlinuz-2.6.18-194.el5PAE ro root=LABEL=/

initrd /boot/initrd-2.6.18-194.el5PAE.img

 As you notice from the above info, it contains kernel and initrd image.
 So, in simple terms GRUB just loads and executes Kernel and initrd
images.
4. Kernel
 Mounts the root file system as specified in the “root=” in grub.conf
 Kernel executes the /sbin/init program
 Since init was the 1st program to be executed by Linux Kernel, it has the
process id (PID) of 1. Do a ‘ps -ef | grep init’ and check the pid.
 initrd stands for Initial RAM Disk.
 initrd is used by kernel as temporary root file system until kernel is booted
and the real root file system is mounted. It also contains necessary drivers
compiled inside, which helps it to access the hard drive partitions, and
other hardware.
5. Init
 Looks at the /etc/inittab file to decide the Linux run level.
 Following are the available run levels
 0 – halt
 1 – Single user mode
 2 – Multiuser, without NFS
 3 – Full multiuser mode
 4 – unused
 5 – X11
 6 – reboot
 Init identifies the default initlevel from /etc/inittab and uses that to load
all appropriate program.
 Execute ‘grep initdefault /etc/inittab’ on your system to identify the
default run level
 If you want to get into trouble, you can set the default run level to 0 or 6.
Since you know what 0 and 6 means, probably you might not do that.
 Typically you would set the default run level to either 3 or 5.
6. Runlevel programs
 When the Linux system is booting up, you might see various services
getting started. For example, it might say “starting sendmail …. OK”.
Those are the runlevel programs, executed from the run level directory as
defined by your run level.
 Depending on your default init level setting, the system will execute the
programs from one of the following directories.
 Run level 0 – /etc/rc.d/rc0.d/
 Run level 1 – /etc/rc.d/rc1.d/
 Run level 2 – /etc/rc.d/rc2.d/
 Run level 3 – /etc/rc.d/rc3.d/
 Run level 4 – /etc/rc.d/rc4.d/
 Run level 5 – /etc/rc.d/rc5.d/
 Run level 6 – /etc/rc.d/rc6.d/
 Please note that there are also symbolic links available for these directory
under /etc directly. So, /etc/rc0.d is linked to /etc/rc.d/rc0.d.
 Under the /etc/rc.d/rc*.d/ directories, you would see programs that start
with S and K.
 Programs starts with S are used during startup. S for startup.
 Programs starts with K are used during shutdown. K for kill.
 There are numbers right next to S and K in the program names. Those are
the sequence number in which the programs should be started or killed.
 For example, S12syslog is to start the syslog deamon, which has the
sequence number of 12. S80sendmail is to start the sendmail daemon,
which has the sequence number of 80. So, syslog program will be started
before sendmail.
Linux Kernel
Introduction

 The main purpose of a computer is to run a predefined sequence of instructions, known


as a program. A program under execution is often referred to as a process.
 Special purpose computers are meant to run a single process, but in a general purpose
computer, are intended to run many processes simultaneously.
 Any kind of process requires hardware resources such as Memory, Processor time,
Storage space, etc.
 In a General Purpose Computer running many processes simultaneously, we need a
middle layer to manage the distribution of the hardware resources of the computer
efficiently and fairly among all the various processes running on the computer. This
middle layer is referred to as the kernel.
 Basically the kernel virtualizes the common hardware resources of the computer to
provide each process with its own virtual resources. This makes the process seem as it is
the sole process running on the machine. The kernel is also responsible for preventing
and mitigating conflicts between different processes.
Kernel space and User space
 Kernel Space:
 The kernel is found in an elevated system state, which includes a protected
memory space and full access to the device’s hardware.
 This system state and memory space is altogether referred to as kernel-space.
Within kernel space the core access to the hardware and system services are
managed and provided as a service to the rest of the system.
 User Space:
 The user’s applications are carried out in the user-space, where they can reach a
subset of the machine’s available resources via kernel system calls.
 By using the core services provided the kernel, a user level application can be
created like a game or office productivity software for example.

Figure 0.1: Kernel and User Space

Architectural Components of the Linux Kernel


 A kernel is simply a resource manager; the resource being managed may be a process,
memory or hardware device. It manages and arbitrates access to the resource between
multiple competing users.
 The Linux kernel exists in the kernel space, below the user space, which is where the
user’s applications are executed.
 For the user space to communicate with the kernel space, a GNU C Library is
incorporated which provides a forum for the system call interface to connect to the
kernel space and allow transition back to the user space.
Figure 0.2: Linux System Architecture

 The Linux kernel can be categorized into three primary levels:


 The system call interface: this is the topmost and undertakes the basic actions
such as read and write.
 The kernel code: is located below the system call interface, it is common to all
of the processor architectures supported by Linux, it is sometimes defined as
architecture-independent kernel code.
 The architecture-dependent code: it is under the architecture-independent code,
forms what is usually referred to as a Board Support Package (BSP) – this
contains a small program called the bootloader that places the Operating System
and device drivers into memory.rface to connect to the kernel space and allow
transition back to the userspace.
 The architectural perspective of the Linux kernel consists of: System call interface,
Process Management, the Virtual File system, Memory Management, Network Stack,
Architecture and the Device Drivers.

Figure 0.3: Architecture of Linux Kernel


1. System call interface: is a thin layer that is used to undertake function calls from user
space into the kernel. This interface may be architecture dependent.
2. Process management: is mainly there to execute the processes. These are referred to as
the thread in a kernel and are representing an individual virtualization of the particular
processor.
3. Memory management: memory is managed in what are known as pages for efficiency.
Linux includes the methods in which to manage the available memory as well as the
hardware mechanisms for physical and virtual mappings. Swap space is also provided.
4. Virtual file system: it provides a standard interface abstraction for the file systems. It
provides a switching layer between the system call interface and the file systems
supported by the kernel.
5. Network stack: is designed as a layered architecture modeled after the particular
protocols.
6. Device drivers: a significant part of the source code in the Linux kernel is found in the
device drivers that make a particular hardware device usable.
7. Architecture-dependent code: those elements that depend on the architecture on which
they run, hence must consider the architectural design for normal operation and
efficiency.

Interfaces

 System calls: Applications pass information to the kernel through system calls. A library
contains functions that the applications work with. The libraries then, through the system
call interface, instruct the kernel to perform a task that the application wants.
 Interrupts: Interrupts offer a way through which the Linux kernel manages the systems’
hardware. If hardware has to communicate with a system, an interrupt on the processor
does the trick, and this is passed on to the Linux kernel.
 Linux kernel interfaces: The Linux kernel offers various interfaces to the user space
applications that perform a variety of tasks and have different properties. Two distinct
Application Programming Interface (API) exist; the kernel-user space and the kernel
internal. The Linux API is the kernel-userspace API; it gives access to programs in the
user space into the system resources and services of the kernel. It is made up of the
System Call Interface and the subroutines from the GNU C Library.
 The C standard library: All the system calls of the kernel are within the GNU C Library
whereas, the Linux API is comprised of the system call interface and the GNU C Library,
also called glibc.
 Portable Operating System Interface(POSIX): POSIX is a collective term of
standards for maintaining compatibility among the operating systems. It declares the
API together with utility interfaces and command line shells. The Linux API, not only
has the usable features defined by the POSIX but also has additional features in its kernel.

Linux File System


 Linux file system is the collection of data and/or files stored in a computer’s hard disk or
storage, your computer relies on this file system to find out the location and positioning
of files in your storage.
 There are actually many different file systems that exist for Linux:
1. Ext
 “ext” is an acronym that stands for “extended file system” and was created
in 1992 and is the very first file system designed specifically for Linux.
 Its functionality was designed partly based on the UNIX file system.
 The purpose of its creation originally was to innovate beyond the file
system used before it (the MINIX file system) and overcome its
limitations.
 As this file system is about 30 years old at the time this article was written,
many Linux distros no longer support it, so it is not really used anymore.
2. Ext2:
 Referred to as “second extended system”. Created in 1993, ext2 was
designed to be the successor of the original extension system for Linux.
 It innovated in areas such as storage capacity, and general performance.
 This file system notably allows for up to 2 TB of data.
 Like ext, this file system is very old, so it really should just be avoided.
3. Ext3:
 ext3, or third extended system, created in 2001, surpasses ext2 in that it is
a journaling file system.
 A journaling file system is a system that records in a separate log changes
and updates to files and data before such actions have been completed.
This means that if for some reason, the computer or hard disk(s) crash or
experience some kind of power failure, this separate log containing the
changes made before the crash can be used to access that stored data, thus
repairing and restoring the files upon reboot.
 Nowadays, there are so many better options to choose from that there’s
hardly any reason to use this extended file system anymore either.
4. Ext4:
 ext4, standing for “fourth extended system”, was created in 2006.
 Because this file system overcomes numerous limitations that the third
extended system had, it is both widely used, and the default file system
that most Linux distros use. While it may not be the most cutting edge, it
is absolutely reliable and stable – which is really valuable in Linux.
5. JFS:
 The file system JFS was created by IBM in 1990 and the name JFS is an
acronym standing for Journaling File System.
 It’s easy to recover data after a power failure and quite reliable. It uses
less CPU power than the other file systems.
6. XFS:
 xfs, an acronym that stands for “Extent File System”, was created by
Silicon Graphics and originally made for their OS “IRIX”, but was later
given to Linux.
 XFS is a 64-bit high performance journaling file system. Works well with
very large files but not well with smaller files.
7. Btrfs:
 btrfs, acronym for B Tree File System, created by Oracle in 2009.
 It is regarded as a rival file system to ext4, though it’s consensus that
overall ext4 is the better file system, as it transfers data faster and offers
more stability but although this is the case, that does not mean btrfs isn’t
worth looking into. btrfs. in general has excellent performance.

 Df –T command is used to determine the type of the file system used in your distro.
Figure 0.1: File system used in Ubuntu Distro

Linux File System Directories


 In Linux directories are structured in a tree-like hierarchy.
 The Linux directory structure is well defined and documented in the Linux Filesystem
Hierarchy Standard (FHS).
 Referencing to directories when accessing them is accomplished by using the
sequentially deeper directory names connected by forward slashes (/) such as /var/log and
/var/spool/mail. These are called paths.
 Install “tree” tool in terminal for better understanding of the directory structure in Linux.
If you are using Ubuntu or Debian, use this command: sudo apt install tree
 Execute the following command in terminal: tree -L 1 / you will see the following
structure
Figure 0.1: Linux file Structure

 The instruction above can be translated as "show me only the 1st Level of the directory
tree starting at / (root)". The -L option tells tree how many levels down you want to see.

 / is the top level directory of a Linux system. The name “top level” means the “root”,
thus it is the root directory of the system. Though it is separate from “/root directory”, so
you shouldn’t confuse the two.
 All other directories stem from this top level directory like a pyramid.
 In Linux, these directories in the so-called “pyramid” exist in a hierarchy with a specific
structure.
 To explore the filesystem yourself, use the cd command: cd will take you to the directory
of your choice (cd stands for change directory. If you get confused, pwd will always tell
you where you (pwd stands for print working directory). Also, cd with no options or
parameters, will take you back to your own home directory. cd .. will take you up one
level, getting you one level closer to the / root directory. If you are in
/usr/share/wallpapers and run cd .., you will move up to /usr/share.
Directory Description

 The root filesystem is the top-level directory of the filesystem.


 It must contain all of the files required to boot the Linux system before
other filesystems are mounted.
 It must include all of the required executables and libraries required to
/ (root filesystem)
boot the remaining filesystems.
 After the system is booted, all other filesystems are mounted on
standard, well-defined mount points as subdirectories of the root
filesystem.
 The /bin directory contains user executable files (binaries) of the
applications and programs.
/bin  ls program present in this directory, as well as other basic tools for
making and removing files and directories, moving them around, and
so on.
 Contains the static bootloader and kernel executable and configuration
files required to boot a Linux computer.
 DO NOT TOUCH!. If you mess up one of the files in here, you may
/boot
not be able to run your Linux and it is a pain to repair.
 On the other hand, don’t worry too much about destroying your system
by accident: you have to have superuser privileges to do that.
 This directory contains the device files for every hardware device
attached to the system.
 These are not device drivers, rather they are files that represent each
/dev
device on the computer and facilitate access to those devices.
 For example, if you plug in a new webcam or a USB pendrive into your
machine, a new device entry will automagically pop up here.
 etc stands for “Everything to configure,” as it contains most, if not all
system-wide configuration files.
 For example, the files that contain the name of your system, the users
and their passwords, the names of machines on your network and when
/etc
and where the partitions on your hard disks should be mounted are all
in here.
 If you are new to Linux, it may be best if you don’t touch too much in
here until you have a better understanding of how things work.
 Home directory storage for user files.
 under /home there are two directories: /home/paul, which contains all
/home
my stuff; and /home/guest, in case anybody needs to borrow my
computer.
 /lib is where libraries live. Libraries are files containing code that your
applications can use. They contain snippets of code that applications
use to draw windows on your desktop, control peripherals, or send files
/lib to your hard disk.
 There are more lib directories scattered around the file system, but this
one, the one hanging directly off of / is special in that, among other
things, it contains the all-important kernel modules.
 The kernel modules are drivers that make things like your video card,
sound card, WiFi, printer, and so on, work.

 A place to mount external removable media devices such as USB


/media
thumb drives that may be connected to the host.

 A temporary mountpoint for regular filesystems (as in not removable


/mnt media) that can be used while the administrator is repairing or working
on a filesystem.

 Optional files such as vendor supplied application programs should be


/opt
located here.

 /proc, like /dev is a virtual directory. It contains information


about your computer, such as information about your CPU and
the kernel your Linux system is running.
/proc
 As with /dev, the files and directories are generated when your
computer starts, or on the fly, as your system is running and
things change.

 This is not the root (/) filesystem. It is the home directory for the root
/root
user.

 /sbin is similar to /bin, but it contains applications that only the


superuser (hence the initial s) will need.
 You can use these applications with the sudo command that
/sbin
temporarily concedes you superuser powers on many
distributions. /sbin typically contains tools that can install
stuff, delete stuff and format stuff.
 Some of these instructions are lethal if you use them
improperly, so handle with care.
 Temporary directory. Used by the operating system and many
programs to store temporary files. Users may also store files here
/tmp temporarily.
 Note that files stored here may be deleted at any time without prior
notice.

 These are shareable, read-only files, including executable binaries and


/usr
libraries, man files, and other types of documentation.

 Variable data files are stored here. This can include things like log files,
/var MySQL, and other database files, web server data files, email inboxes,
and much more.
 sys is another virtual directory like /proc and /dev and also contains
information from devices connected to your computer.
 In some cases you can also manipulate those devices. I can, for
example, change the brightness of the screen of my laptop by
modifying the value stored in
/sys
the /sys/devices/pci0000:00/0000:00:02.0/drm/card1/card1-eDP-
1/intel_backlight/brightness file (on your machine you will probably
have a different file).
 But to do that you have to become superuser.

Figure 0.2: Linux File System

You might also like