Linux Tutorial – The Linux File system

0
48
LInux

This chapter explains Introduction to Linux file system – Directory tree, Common Directories,  special Directories, Absolute and relative paths.

The Linux File system


● 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  sub directories, which contain more files and  sub directories 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

/  The root directory , 

Where everything begins
/etc
 This directory contains system configuration files

/bin

This directory contains the commands and utilities that you on a daily basis (All the users have access to it)


/sbin
 This directory contains programs that performs vital system tasks (Network management , Disk  partitioning).Only the superuser has access to these  programs.


/home
Each user is given a directory under the home directory .A user can store anything in his home  directory Ex:Music files,Pictures, …etc


/opt
This directory contains optional commercial software  products that are not installed by default on the  system (Ex: Google Earth)


/tmp
This directory contains temporary files created by various programs. Generally cleared on reboot


/var
Contains variable data (Ex: databases, spool files, user mail, etc. are located here. )

Common Directories

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

LEAVE A REPLY

Please enter your comment!
Please enter your name here