100% found this document useful (1 vote)
124 views

Linux File System

The document describes the standard Linux filesystem structure. It outlines the purpose and essential contents of key directories like /bin, /boot, /dev, /etc, /home, /lib, /media, /mnt, /opt, /proc, /root, /sbin, /srv, /sys, /usr, and /var. Maintaining this standardized structure ensures applications and users can reliably access and write files.

Uploaded by

Raj Shekar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
124 views

Linux File System

The document describes the standard Linux filesystem structure. It outlines the purpose and essential contents of key directories like /bin, /boot, /dev, /etc, /home, /lib, /media, /mnt, /opt, /proc, /root, /sbin, /srv, /sys, /usr, and /var. Maintaining this standardized structure ensures applications and users can reliably access and write files.

Uploaded by

Raj Shekar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 24

LINUX FILESYSTEM

Bangaru Rajshekar
HERARECIAL FILE STRUCTURE
File System Structure
• Why Share a Common Structure?
• The file system structure is the most basic level of
organization in an operating system. Almost all of
the ways an operating system interacts with its
users, applications, and security model are
dependent upon the way it organizes files on
storage devices. Providing a common file system
structure ensures users and programs are able to
access and write files.
File System Structure
• File systems break files down into two logical
categories:
• Shareable vs. unshareable files
• Variable vs. static files
• Shareable files are those that can be accessed locally and
by remote hosts; unshareable files are only available
locally.
• Variable files, such as documents, can be changed at any
time; static files, such as binaries, do not change without
an action from the system administrator.
File System Structure
• The reason for looking at files in this manner is to help
correlate the function of the file with the permissions
assigned to the directories which hold them. The way in
which the operating system and its users interact with a
given file determines the directory in which it is placed,
whether that directory is mounted with read-only or
read/write permissions, and the level of access each user has
to that file.
• The top level of this organization is crucial. Access to the
underlying directories can be restricted or security problems
could manifest themselves if, from the top level down, it
does not adhere to a rigid structure.
File System Hierarchy Standard (FHS)

• Red Hat Enterprise Linux uses the Filesystem


Hierarchy Standard (FHS) file system structure,
which defines the names, locations, and permissions
for many file types and directories.
• The FHS document is the authoritative reference to
any FHS-compliant file system, but the standard
leaves many areas undefined or extensible. This
section is an overview of the standard and a
description of the parts of the file system not covered
by the standard.
• /bin • /proc
• /boot • /root
• /dev • /sbin
• /etc • /srv
• /home • /tmp
• /lib • /usr
• /media • /var
• /mnt
• /opt
The /boot/ Directory
• The /boot/ directory contains static files
required to boot the system, such as the
Linux kernel.
• These files are essential for the system to boot
properly.
The /dev/ Directory
• The /dev/ directory contains device nodes that either
represent devices that are attached to the system or
virtual devices that are provided by the kernel. These
device nodes are essential for the system to function
properly. The udev demon takes care of creating and
removing all these device nodes in /dev/.
• Devices in the /dev directory and subdirectories are
either character (providing only a serial stream of
input/output) or block (accessible randomly).
Character devices include mouse, keyboard, modem
while block devices include hard disk, floppy drive etc.
The /dev/ Directory
• If you have GNOME or KDE installed in your system, devices
such as external drives or cds are automatically detected
when connected (e.g via usb) or inserted (e.g via CD or DVD
drive) and a popup window displaying the contents is
automatically displayed. Files in the /dev directory are
essential for the system to function properly.
The /etc/ Directory
• The /etc/ directory is reserved for configuration files that are
local to the machine. No binaries are to be placed in /etc/.
Any binaries that were once located in /etc/ should be placed
into /sbin/ or /bin/.
• The /etc/X11/ directory is for X Window System configuration
files, such as xorg.conf. The /etc/skel/ directory is for
"skeleton" user files, which are used to populate a home
directory when a user is first created. Applications also store
their configuration files in this directory and may reference
them when they are executed.
The /lib/ Directory
• The /lib/ directory should contain only those
libraries needed to execute the binaries in
/bin/ and
• /sbin/. These shared library images are
particularly important for booting the system
and executing
• commands within the root file system.
The /media/ Directory
• The /media/ directory contains
subdirectories used as mount points for
removeable media such as usb storage
media, DVDs, CD-ROMs, and Zip disks.
The /mnt/ Directory
• The /mnt/ directory is reserved for temporarily
mounted file systems, such as NFS file system
mounts. For all removeable media, please use the
/media/ directory. Automatically detected
removeable media will be mounted in the /media
directory
The /opt/ Directory
• The /opt/ directory provides storage for most
application software packages.
• A package placing files in the /opt/ directory creates
a directory bearing the same name as the package.
This directory, in turn, holds files that otherwise
would be scattered throughout the file system, giving
the system administrator an easy way to determine
the role of each file within a particular package.
For example, if sample is the name of a particular
software package located within the /opt/ directory,
then all of its files are placed in directories inside
the /opt/sample/ directory, such as
/opt/sample/bin/ for binaries and
/opt/sample/man/ for manual pages
The /proc/ Directory
• The /proc/ directory contains special files
that either extract information from or send
information to
• the kernel. Examples include system memory,
cpu information, hardware configuration etc.
The /sbin/ Directory
• The /sbin/ directory stores executables used by the
root user. The executables in /sbin/ are used at boot
time, for system administration and to perform system
recovery operations. Of this directory, the FHS says:
/sbin contains binaries essential for booting, restoring,
recovering, and/or repairing the system in addition to the binaries
in /bin. Programs executed after /usr/ is known to be mounted
(when there are no problems) are generally placed into /usr/sbin.
Locally-installed system administration programs should be
placed into /usr/local/sbin.
At a minimum, the following programs should be in
/sbin/:arp, clock,
The /srv/ Directory
• The /srv/ directory contains site-specific data
served by your system running Red Hat
Enterprise Linux. This directory gives users the
location of data files for a particular service,
such as FTP, WWW, or CVS. Data that only
pertains to a specific user should go in the
/home/ directory.
The /sys/ Directory
• The /sys/ directory utilizes the new sysfs
virtual file system specific to the 2.6 kernel.
With the increased support for hot plug
hardware devices in the 2.6 kernel, the /sys/
directory contains information similarly held
in /proc/, but displays a hierarchical view of
specific device information in regards to hot
plug devices.
The /usr/ Directory
• The /usr/ directory is for files that can be
shared across multiple machines. The /usr/
directory is often on its own partition and is
mounted read-only. At a minimum, the
following directories should be subdirectories of
/usr/:
The /usr/local/ Directory
• The FHS says:
• The /usr/local hierarchy is for use by the system
administrator when installing software locally. It
needs to be safe from being overwritten when
the system software is updated. It may be used
for programs and data that are shareable among
a group of hosts, but not found in /usr.
• The /usr/local/ directory is similar in structure
to the /usr/ directory. It has the following
subdirectories, which are similar in purpose to
those in the /usr/ directory:
The /var/ Directory
• Since the FHS requires Linux to mount /usr/ as
read-only, any programs that write log files or
need
• spool/ or lock/ directories should write them to
the /var/ directory. The FHS states /var/ is for:
• ...variable data files. This includes spool
directories and files, administrative and
• logging data, and transient and temporary files.
• Below are some of the directories found within
the /var/ directory:

You might also like