A Linux operating system has a hierarchical file structure, with the necessary directories for storing system, user, application, kernel, library, and temp files. The standard Linux commands are included in the file hierarchy, as well. Together, the directories, commands, and various types of files allow the Linux operating system to function properly.
Below is how the Linux file hierarchy is organized, including where the main Linux commands are located, and what files each directory stores. Click the blue triangle next to a directory name to expand and view additional details, including the types of files, commands, and sub-directories associated with that directory.
Linux file hierarchy
- / (root directory)
- /bin (essential binaries)
- cat
- chgrp
- chmod
- chown
- cp
- data
- dd
- df
- dmesg
- echo
- false
- hostname
- kill
- ln
- login
- ls
- mkdir
- mknod
- more
- mount
- mv
- ps
- pwd
- rm
- rmdir
- sed
- sh
- stty
- su
- synch
- true
- umount
- uname
- /boot (static files of the boot loader)
- boot
- grub
- initrd
- kernel
- module.info
- system.map
- vmlinuz
- /dev (location of device/special files)
- Contains device files created during installation.
- /etc (host-specific system configuration)
- /opt (configuration files for optional application software)
- Contents vary depending on installed software.
- csh.login
- exports
- fstab
- ftpusers
- gateways
- gettydefs
- group
- host.conf
- hosts
- hosts.allow
- hosts.deny
- hosts.equiv
- hosts.lpd
- inetd.conf
- inittab
- issue
- ls.co.conf
- motd
- mtab
- mtools
- networks
- passwd
- printcap
- profile
- protocols
- resolv.conf
- rpc
- securetty
- services
- shells
- syslog.conf
- /home (user home directories)
- Initially empty, until a non-root user is created.
- /lib (library/kernel modules)
- Contains libraries required by binaries in /bin and /sbin.
- /mnt (mount points for temporary file systems)
- Initially empty in some distributions. Removable disks may be mounted here automatically when inserted.
- /opt (optional application file systems)
- Contents vary depending on installed software.
- /root (home directory for the root user)
- Initial contents may vary by distribution.
- /sbin (system binaries)
- fastboot
- fasthalt
- fdisk
- fsck
- getty
- halt
- ifconfig
- init
- mkfs
- mkswap
- reboot
- route
- swapoffswapon
- update
- /tmp (temporary files deleted when system boots)
- Initially empty when system is booted.
- /usr (read-only and shareable data)
- /bin (contains most user commands)
- perl
- python
- /include (C standard library header files)
- /lib (obj, bin, lib files for packages/programs) If the system has an MTA (mail transfer agent) installed, a binary or symlink named sendmail must exist in this directory.
- /local (host-specific software and local data)
- /bin
- /games
- /include
- /lib
- /man
- /sbin
- /share
- /src
- /sbin (non-essential system binaries)
- /share (static data shareable across all architectures)
- /man (manual pages for general commands)
- /man1 (manual pages for user programs)
- /man2 (manual pages for system calls)
- /man3 (manual pages for library functions)
- /man4 (manual pages for special files)
- /man5 (manual pages for file formats)
- /man6 (manual pages for games, etc.)
- /man7 (miscellaneous manual pages)
- /man8 (manual pages for root commands)
- /var (files expected to grow, such as system logs)
- /cache (application cache data)
- /lib (variable state info that remains after reboot)
- /lock (lock files for shared resources)
- /log (log directory and files)
- lastlog
- messages
- wtmp
- /opt (variable data of installed packages)
- /run (information of system since it was booted up)
- /spool (data waiting for processing)
- /lpd
- /mqueue
- /news
- /rwho
- /uucp
- /tmp (temporary application files, not deleted on boot)
- /yp (files for NIS (Network Information Service))
The hierarchical file structure below is the minimum file system defined by the FHS (Filesystem Hierarchy Standard). Your Linux file system may have additional commands, files, and directories compared to what is shown below, especially if you have installed other packages and programs. Additionally, some Linux variants may diverge from the standard file system and look different than the structure below.
/bin (essential binaries)
cat
chgrp
chmod
chown
cp
data
dd
df
dmesg
echo
false
hostname
kill
ln
login
ls
mkdir
mknod
more
mount
mv
ps
pwd
rm
rmdir
sed
sh
stty
su
synch
true
umount
uname
/boot (static files of the boot loader)
boot
grub
initrd
kernel
module.info
system.map
vmlinuz
/dev (location of device/special files)
Contains device files created during installation.
/etc (host-specific system configuration)
/opt (configuration files for optional application software)
Contents vary depending on installed software.
csh.login
exports
fstab
ftpusers
gateways
gettydefs
group
host.conf
hosts
hosts.allow
hosts.deny
hosts.equiv
hosts.lpd
inetd.conf
inittab
issue
ls.co.conf
motd
mtab
mtools
networks
passwd
printcap
profile
protocols
resolv.conf
rpc
securetty
services
shells
syslog.conf
/home (user home directories)
Initially empty, until a non-root user is created.
/lib (library/kernel modules)
Contains libraries required by binaries in /bin and /sbin.
/mnt (mount points for temporary file systems)
Initially empty in some distributions. Removable disks may be mounted here automatically when inserted.
/opt (optional application file systems)
Contents vary depending on installed software.
/root (home directory for the root user)
Initial contents may vary by distribution.
/sbin (system binaries)
fastboot
fasthalt
fdisk
fsck
getty
halt
ifconfig
init
mkfs
mkswap
reboot
route
swapoffswapon
update
/tmp (temporary files deleted when system boots)
Initially empty when system is booted.
/usr (read-only and shareable data)
/bin (contains most user commands)
perl
python
/include (C standard library header files)
/lib (obj, bin, lib files for packages/programs) If the system has an MTA (mail transfer agent) installed, a binary or symlink named sendmail must exist in this directory.
/local (host-specific software and local data)
/bin
/games
/include
/lib
/man
/sbin
/share
/src
/sbin (non-essential system binaries)
/share (static data shareable across all architectures)
/man (manual pages for general commands)
/man1 (manual pages for user programs)
/man2 (manual pages for system calls)
/man3 (manual pages for library functions)
/man4 (manual pages for special files)
/man5 (manual pages for file formats)
/man6 (manual pages for games, etc.)
/man7 (miscellaneous manual pages)
/man8 (manual pages for root commands)
/var (files expected to grow, such as system logs)
/cache (application cache data)
/lib (variable state info that remains after reboot)
/lock (lock files for shared resources)
/log (log directory and files)
lastlog
messages
wtmp
/opt (variable data of installed packages)
/run (information of system since it was booted up)
/spool (data waiting for processing)
/lpd
/mqueue
/news
/rwho
/uucp
/tmp (temporary application files, not deleted on boot)
/yp (files for NIS (Network Information Service))
cat
chgrp
chmod
chown
cp
data
dd
df
dmesg
echo
false
hostname
kill
ln
login
ls
mkdir
mknod
more
mount
mv
ps
pwd
rm
rmdir
sed
sh
stty
su
synch
true
umount
uname
boot
grub
initrd
kernel
module.info
system.map
vmlinuz
Contains device files created during installation.
/opt (configuration files for optional application software)
Contents vary depending on installed software.
csh.login
exports
fstab
ftpusers
gateways
gettydefs
group
host.conf
hosts
hosts.allow
hosts.deny
hosts.equiv
hosts.lpd
inetd.conf
inittab
issue
ls.co.conf
motd
mtab
mtools
networks
passwd
printcap
profile
protocols
resolv.conf
rpc
securetty
services
shells
syslog.conf
Contents vary depending on installed software.
Initially empty, until a non-root user is created.
Contains libraries required by binaries in /bin and /sbin.
Initially empty in some distributions. Removable disks may be mounted here automatically when inserted.
Initial contents may vary by distribution.
fastboot
fasthalt
fdisk
fsck
getty
halt
ifconfig
init
mkfs
mkswap
reboot
route
swapoffswapon
update
Initially empty when system is booted.
/bin (contains most user commands)
perl
python
/include (C standard library header files)
/lib (obj, bin, lib files for packages/programs) If the system has an MTA (mail transfer agent) installed, a binary or symlink named sendmail must exist in this directory.
/local (host-specific software and local data)
/bin
/games
/include
/lib
/man
/sbin
/share
/src
/sbin (non-essential system binaries)
/share (static data shareable across all architectures)
/man (manual pages for general commands)
/man1 (manual pages for user programs)
/man2 (manual pages for system calls)
/man3 (manual pages for library functions)
/man4 (manual pages for special files)
/man5 (manual pages for file formats)
/man6 (manual pages for games, etc.)
/man7 (miscellaneous manual pages)
/man8 (manual pages for root commands)
perl
python
If the system has an MTA (mail transfer agent) installed, a binary or symlink named sendmail must exist in this directory.
/bin
/games
/include
/lib
/man
/sbin
/share
/src
/man (manual pages for general commands)
/man1 (manual pages for user programs)
/man2 (manual pages for system calls)
/man3 (manual pages for library functions)
/man4 (manual pages for special files)
/man5 (manual pages for file formats)
/man6 (manual pages for games, etc.)
/man7 (miscellaneous manual pages)
/man8 (manual pages for root commands)
/man1 (manual pages for user programs)
/man2 (manual pages for system calls)
/man3 (manual pages for library functions)
/man4 (manual pages for special files)
/man5 (manual pages for file formats)
/man6 (manual pages for games, etc.)
/man7 (miscellaneous manual pages)
/man8 (manual pages for root commands)
/cache (application cache data)
/lib (variable state info that remains after reboot)
/lock (lock files for shared resources)
/log (log directory and files)
lastlog
messages
wtmp
/opt (variable data of installed packages)
/run (information of system since it was booted up)
/spool (data waiting for processing)
/lpd
/mqueue
/news
/rwho
/uucp
/tmp (temporary application files, not deleted on boot)
/yp (files for NIS (Network Information Service))
lastlog
messages
wtmp
/lpd
/mqueue
/news
/rwho
/uucp
Related information
- Unix and Linux commands help.
- Linux help and support.