Вы находитесь на странице: 1из 10

Linux file system structure - Nam Huy Linux

NAM HUY LINUX

Geeky Open Source Linux Tutorials

HOME

ABOUT

ARCHIVES

Search me...

CONTACT

Linux file system structure


07/07/2014 by namhuy 3 Comments

Linux Operating System and Linux File System are


totally different from Microsoft Windows. In Microsoft
Windows, you usually see Windows is installed in C:\
drive. In Linux, the Filesystem Hierarchy Standard
(FHS) defines the structure of file systems on Linux
and other UNIX-like operating systems, everything is
configured as a file including directories, partitions, and
http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

hardware device drivers. All files and directories will be


displayed under the root directory, even if your data is
stored on different physical devices. I have explained
what is Linux, now lets dig a little deeper into Linux
file system structure.

Linux file system layout


This is a layout file system structure from a CentOS linux, depends on the system and linux distro, the
structure may vary, and directories may be removed or added.

/ The Root Directory


Everything on Linux system is located under the / or root directory. The meaning of / or root and root user
are often confusing to new Linux users. In Linux, the root directory / (The tree of the file system starts at
the trunk or slash, indicated by a forward slash /) is a separator between a file and a directory contains all
underlying directories and files, yet root user is a super user or administrator user with has administrative
privileges on the system vs Linux privileged users who only have limited privileges to protect system
security.

/bin Essential command binaries


The /bin directory is a place contains most commonly essential executable terminal binaries programs or file
required during booting, repairing like cat, ls, mount, rm, du, df, tar, rpm, wc, etc.

/boot Boot loader files


http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

All of the required files to boot the system contains in /boot directory, including GRUB boot loaders files,
Linux kernels, the Linux initial RAM disk (initrd),

/dev Device Files


All of the hardware devices on the machine like cdrom, cpu, hard drives, etc will be stored as special device
files that represent all the devices in /dev directory. Device files are created during your Linux system
installation.

/etc Configuration Files


Contain host-specific files and directories, e.g. information about system and application configuration files
like startup, shutdown, start, stop script for every individual program. In another word /etc data is very
similar to Control panel in Microsoft Windows.

/home Home Directory


Home directory of the the users. Every time you create a new user, a new directory with users name is
created in /home directory for users to store their own files within their own homes directory. Most common
automatic directories created within /home s user are Desktop, Downloads, Documents, Music, Movie, etc.
Most programs configuration file for a specific user will be saved in its users /home directory like web
browser settings, web browser bookmarks, desktop wallpaper, themes, and passwords.

/lib Essential Libraries


Similar to Windows dll files, all Linux shared libraries and kernel modules files stores in /lib directory.
These important Linux dynamic libraries are required to boot the system and run commands in the root file
system.

/lost+found Recovering Files


Sounds weird but yes we have lost+found in Linux file system structure. Every Linux file system and
partitions has a lost+found in its directory. In the even your system is crashed or unexpected shutdown, you
can run fsck command to check and repair the filesystem, fsck will turn any corrupted or almost-deleted files
back into files that you can recover them later in /lost+found directory.

/media Removable Media Devices


Every time you insert a removable device such as external hard drive, floppy disk, zip drive, CDs, DVDs,
flash drive to a Linux system, a new directory will automatically be created inside the /media directory.
/media directory is a temporary mount directory for removable devices.

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

/mnt Temporarily mounted filesystems


While /media is where the system automatically mounts removable media, /mnt is for you to mount things
(partitions, file systems, devices) manually and temporarily.

/opt Optional software packages


The /opt directory is reserved to store addition software or extra and third party software for your system,
those addition software usually dont follow the standard file system hierarchy and not handled by the
package manager.

/proc Kernel & Process Information


Similar to /dev, /proc directory contains information about running process, system resources and
information. You can view information about any running process with a specific process-id (pid) or
hardwares information such as memory, cpu, io, etc

/root Root Home Directory


Dont be confused with / or root directory, /root is a root accounts home directory determined by
developer or local preference rather than /home/root to allow for booting the system even if /home/ is not
available.

/sbin System binaries


Similar to /bin, /sbin contains essential binaries that are generally intended to be run by the root user for
system administration and maintenance purpose. For example: iptables, reboot, fdisk, ifconfig, swapon, init,
ip, mount

/selinux Security-Enhanced Linux


Selinux comes with RedHat based distro (fedora, centos), selinux is a security architecture integrated into the
2.6.x kernel using the Linux Security Modules (LSM). For some reason Centos 6 created an emtpry selinux
directory in root directory, the real selinux directory with its configuration files are stored in /etc/selinux/
directory.

/srv Service Data


Server (srv) contains data of services such as HTTP, FTP, rsync, cvs

/sys virtual filesystem


Some newer Linux distros have /sys directory with sysfs virtual filesystem to store information and statistics
about (physical and virtual) device and device names. /sys is newly added since Linux kernel 2.6 /sys

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

contains similar information with /proc which display device information about the kernels view of the
system.

/tmp Temporary files


Systems Temporary Directory, all users and programs in your system can access/read/write in this directory.
You should not save/store any important files/directories under /tmp since all files will be removed after
system is rebooted.

/usr binaries, documentation, source code, libraries


Pronounced as user, /usr contains the majority of user utilities, programs, libraries, documentation etc for all
user-related second level programs rather than applications and files used by the system.

/var Variable Files


Variable or /var contains data that is expected to change and grow as the system is running (log, mail, spool,
temp)

Share It:

11

Related

How to install Microsoft Office 2007 on Linux


09/20/2010
In "Linux"

Virus and Malware vs Linux


03/06/2014
In "Linux"

What is Linux ?
06/09/2014
In "Linux"

Filed Under: Linux

Comments

JuanSysT says

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

07/13/2014 at 1:36 pm
muy buen articulo
Reply

allam003 says
07/18/2014 at 7:45 am
thanks sir, its helpful.
Reply

T says
09/11/2014 at 7:38 pm
Hello Huy
Long time no see ! I hope you doing well
So, the theme of a linux file system which i prefer is How many files in directory is too many
Windows /Linux
Everybody can know about file system on linux but not all to clear all things difference between
(fat32/ntfs/ext3,ext4 v.v.)
http://stackoverflow.com/questions/466521/how-many-files-can-i-put-in-a-directory
It s very interesting for me
Reply

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

Leave a Reply
Enter your comment here...

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

RECENT POSTS
How to install OpenVPN Access Server OpenVPN-AS on CentOS 6
How to upgrade from CentOS 6 to 7
Linux file system structure
Browse web in linux via terminal with w3m and xterm
How to secure Apache HTTP Web Server
Netflix supports HTML5 and ditches Silverlight
Tracking centos server with bash script
What is Linux ?
How to install nginx as frontend for apache
IP Restrict access with GeoIP database on nginx

SPONSORED LINKS

Advertise Here

Advertise Here

Advertise Here

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Advertise Here

Linux file system structure - Nam Huy Linux

CATEGORIES
Android
Bash Scripting
CentOS
Debian
Fedora
Firefox
Games
Hardware
Linux
Linux Mint
MariaDB
MySQL
Networking
Open Source
Security
Server
Software
Tips Tricks
Ubuntu
Wordpress
Xubuntu

MONTHLY POPULAR POSTS


How to change date, time, timezone on centos 6
How to install VNC Server on Ubuntu 14.04
Install GUI on debian 7 wheezy
How to install gui to centos minimal
How to tweak and optimize SSD for Ubuntu, Linux Mint
http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Linux file system structure - Nam Huy Linux

How to fix slow performance ubuntu 13.04 running in virtualbox


SSH login without password
add delete and switch user in ubuntu by command lines
How to upgrade from Ubuntu 12.04 LTS to Ubuntu 14.04 LTS
How to install Netflix on Ubuntu, Linux Mint and Fedora

ABOUT US
Huy Tran
Contribute
Copyright
Privacy Policy
Terms Of Service

SUBSCRIBE
RSS Feed
XML RSS Feed
Subscribe by Email

2014 Nam Huy Linux. Generated in 0.337 seconds.

http://www.namhuy.net/3230/linux-file-system-structure.html[11/14/2014 8:13:00 PM]

Вам также может понравиться