3.1 Filesystem PDF
3.1 Filesystem PDF
● The Linux file system has a tree like structure.
● The tree like structure is also referred to as
the Directory tree
● When we draw the Linux file system on a paper ,
we see a tree like structure developing. That's
why it is called the directory tree.
● A folder is a location that stores multiple files
● Windows users usually use the word folder instead
of a directory, however , in Linux terminology we
always say a directory instead of a folder.
The Directory Tree
Here are some facts about the directory tree
● Each directory (or file) has exactly one parent
● The first directory (top most) in our directory
tree is called the root directory .It is
represented by a forward slash /
● The root directory contains files and
subdirectories, which contain more files and
subdirectories and so on.
Visualizing the file system
/
bin opt home tmp var
ls pwd chrome earth john david temporary files log files
music documents
phone.txt
Common Directories
/ The root directory , Where everything begins
This directory contains system configuration files
/etc
/bin This directory contains the commands and utilities that
you on a daily basis (All the users have access to it)
This directory contains programs that performs
vital system tasks (Network management , Disk
/sbin
partitioning).Only the superuser has access to these
programs.
Each user is given a directory under the home
directory .A user can store anything in his home
/home
directory
Ex:Music files,Pictures, ...etc
This directory contains optional commercial software
/opt products that are not installed by default on the
system (Ex: Google Earth)
This directory contains temporary files created by
/tmp
various programs. Generally cleared on reboot
Contains variable data (Ex: databases, spool files, user
/var mail, etc. are located here. )
Two special Directories
● Under each directory , we have two special
directories
(1) The current directory represented as .
(2) The parent directory represented as ..
● and so one dot refers to the current directory
and two dots refers to the parent (Previous)
directory.
Absolute and relative paths
● An absolute path begins with the root directory
and follows the directory tree branch by branch
until the path to the desired directory or file is
completed.
● Example
/home/john/documents/phone.txt
is the absolute path of the file phone.txt
Notice we use a / to separate between directories.
● A relative path starts from the current working
directory.
Example
if our current working directory is john
then ./documents/phone.txt is relative path of
the file phone.txt
● You can omit the ./ and so documents/phone.txt
also works