Linux | Cloud | DevOps | Scripting

Breaking

Tuesday 2 September 2014

File System in Linux


/: (the root directory)
This is the top-level directory and the first directory in Linux, which is created at the time of OS installation. 

/root: (the home directory of Super User)
Root is the Super User in Linux. The root user can perform any task in Linux. /root provides the working environment for root user.

/home: (the home directory for all other users)
Basically, every user is allowed to work in his home directory. /home provides the working environment for all of the users (other than root). By default, one sub-directory named, same as the username, is created in /home automatically when we create a user.

/boot: (contains the bootable files for Linux)
It is a directory which contains all bootable files, like; InitRD (Initial Ram Disk), GRUB (Grand Unified Boot Loader), boot.ini, ntldr etc.

/etc: (contains all configuration files)
This is the directory which contains all configuration files, like:

/etc/passwd (contains user information)
/etc/resolv.conf (used to configure DNS Name Servers)

/usr: (software installation directory)
This is the by default installation directory of any software in Linux. This is same as 'C:\Program Files' in Windows.

/opt: (the optional directory)
This is the optional directory for /usr. It contains third party software.

/bin: (binary files)
It is a binary directory that contains binary files executable commands used by all users. Executable files can run by both Root and normal user, depends on permissions of that particular file.

/sbin: (super user's binary files)
This directory contains the commands used by Super User (root). 

/dev: (contains the device files)
This is just like Device Manager in Windows. It's a device directory, contains all files after attachment with the system. Like; /dev/had for hard disk and /dev/cdrom for CD-ROM.

But, if we connect USB to the system, it will show the device file. To access the data from USB, we need to mount it. In the graphical phase, it mounts automatically but in the case of CLI, we have to mount it manually.

/proc: (contains process files)
This is also called a Virtual Directory. Its contents are not permanent, they keep changing. /proc directory contains useful information about the running system, kernel and processes, like;

/proc/meminfo: information related to memory (RAM/SWAP).
/proc/cpuinfo: information about CPU.

/var: (contains variable data)
It is the storage for all variable files and temporary files created by users, such as log files, the mail queue and the print spooler area etc. 

/mnt: (the default mount point)
This is a location to temporarily mount a media. This is the default mount point for any partition. Bu default this directory is empty.

/media: 
It contains the mount points for removable media like USB disks, CD-ROM and Pen drive.

/lib: (contains library files)
This contains the files which are similar to .dll files in Windows. These files are only used by OS.

SOME MORE IMPORTANT DIRECTORIES:

cgroup: 
It is another name for Control Groups. In a cgroup, there is a set of tasks/processes. Cgroups are organized in a tree-structured hierarchy. There can be more than one hierarchy in the system. You may use a different or alternate hierarchy to cope with specific situations.

lost + found: 
Linux should always go through a proper shutdown. Sometimes your system might crash or a power failure might take the machine down. Either way, at the next boot, a lengthy filesystem check using fsck will be done. Fsck will go through the system and try to recover any corrupt files that it finds. The result of this recovery operation will be placed in this directory. The files recovered are not likely to be complete or make much sense but there always is a chance that something worthwhile is recovered. Each partition has its own lost+found directory. If you find files in there, try to move them back to their original location. If you find something like a broken symbolic link to 'file', you have to reinstall the file/s from the corresponding RPM, since your file system got damaged so badly that the files were mutilated beyond recognition. Below is an example of a /lost+found directory. As you can see, the vast majority of files contained here are in actual fact sockets. As for the rest of the other files they were found to be damaged system files and personal files. These files were not able to be recovered.

misc:  
For miscellaneous purposes.

net:  
Standard mount point for entire remote file systems. 

selinux: 
SE-Linux stands for Secured Enhanced Linux, that stores Security related directories and files.

srv:  (Services Directory) 
This directory stores database files.

sys:  
This directory contains information about the available hardware and kernel tasks.

tmp:  
The temporary space to use by the system, cleaned upon reboot, so don't use this for saving any work.





No comments:

Post a Comment

Pages