Filesystem Hierarchy Standard

Like all UNIXes out there, Linux uses a big filesystem tree like the one below:

 

 

 

 

Following the Filesystem Hierarchy Standard (which most distributions abide by) implies having the directories and contents laid out below.

The root filesystem (“/“) must include all the necessary tools (binaries, libraries, configuration files, etc) to boot, restore, recover and repair the system. This filesystem includes a number of directories…

The bin directory contains essential binaries for all users that should also be available in single-user mode. Here below we can see the typical contents of bin with the must-have binaries in bold:

marc:/bin> ls
arch       dbus-daemon    false           hostname     logger   nisdomainname  readlink    setvesablank    systemd-ask-password
awk        dbus-monitor   fgconsole       initviocons  login    openvt         resizecons  setvtrgb        tar
basename   dbus-send      fgrep           ip           ls       outpsfheader   rm          sh              tcsh
bash       dbus-uuidgen   fillup          ipg          lsblk    pgrep          rmdir       showconsolefont touch
cat        dd             find            kbdinfo      lsmod    pidof          rpm         showkey         true
chgrp      deallocvt      findmnt         kbd_mode     mail     ping           sash        sleep           umount
chmod      df             fsync           kbdrate      mapscrn  ping6          screendump  sort            uname
chown      dmesg          fuser           keyctl       md5sum   pkill          sed         spawn_console   unicode_start
chvt       dnsdomainname  gawk            kill         mkdir    plymouth       setfont     spawn_login     unicode_stop
clrunimap  domainname     getkeycodes     kmod         mknod    ps             setkeycodes stat            usleep
cp         dumpkeys       getunimap       ksh          mktemp   psfaddtable    setleds     stty            vi
cpio       echo           grep            ksh93        more     psfgettable    setlogcons  su              vim
csh        ed             guess_encoding  ln           mount    psfstriptable  setmetamode sync            ypdomainname
date       egrep          gunzip          loadkeys     mv       psfxtable      setpalette  systemctl       zcat
ex         gzip           loadunimap      netstat      pwd      setserial      systemd     zsh

The sbin directory contains essential binaries for booting, restoring, recovering and repairing the system as well as others meant to be used by privileged users. Here below we can see the typical contents of bin with the must-have binaries in bold:

marc:/sbin> ls -logh | awk ‘{ print $7, $8, $9 }’
adjtimex -> /usr/sbin/adjtimex
agetty -> /usr/sbin/agetty
apparmor_parser
arp
arping -> /usr/sbin/arping
audispd -> /usr/sbin/audispd
auditctl -> /usr/sbin/auditctl
auditd -> /usr/sbin/auditd
augenrules -> /usr/sbin/augenrules
aureport -> /usr/sbin/aureport
ausearch -> /usr/sbin/ausearch
autrace -> /usr/sbin/autrace
badblocks -> /usr/sbin/badblocks
blkdeactivate
blkid -> /usr/sbin/blkid
blockdev -> /usr/sbin/blockdev
blogctl
blogd
blogger
brcm_iscsiuio -> iscsiuio
brctl -> /usr/sbin/brctl
btrfs -> /usr/sbin/btrfs
btrfsck -> /usr/sbin/btrfsck
btrfs-convert -> /usr/sbin/btrfs-convert
btrfs-debug-tree -> /usr/sbin/btrfs-debug-tree
btrfs-image -> /usr/sbin/btrfs-image
btrfs-show-super -> /usr/sbin/btrfs-show-super
btrfstune -> /usr/sbin/btrfstune
btrfs-zero-log -> /usr/sbin/btrfs-zero-log
cfdisk -> /usr/sbin/cfdisk
chcpu -> /usr/sbin/chcpu
checkproc
chkconfig -> /usr/bin/chkconfig
chkstat-polkit
clockdiff -> /usr/sbin/clockdiff
crda -> /usr/sbin/crda
cryptsetup -> /usr/sbin/cryptsetup
ctrlaltdel -> /usr/sbin/ctrlaltdel
debugfs -> /usr/sbin/debugfs
debugfs.reiserfs -> debugreiserfs
debugreiserfs
depmod -> /usr/bin/kmod
dhclient
dhclient6 -> dhclient
dhclient-script
dmeventd
dmevent_tool
dmraid
dmsetup
dosfsck -> /usr/sbin/dosfsck
dosfslabel -> /usr/sbin/dosfslabel
dumpe2fs -> /usr/sbin/dumpe2fs
e2fsck -> /usr/sbin/e2fsck
e2image -> /usr/sbin/e2image
e2label -> /usr/sbin/e2label
e2undo -> /usr/sbin/e2undo
ether-wake
ethtool -> /usr/sbin/ethtool
fbtest -> /usr/sbin/fbtest
fdisk -> /usr/sbin/fdisk
findfs -> /usr/sbin/findfs
fsadm
fsck -> /usr/sbin/fsck
fsck.btrfs -> /usr/sbin/fsck.btrfs
fsck.cramfs -> /usr/sbin/fsck.cramfs
fsck.ext2 -> /usr/sbin/fsck.ext2
fsck.ext3 -> /usr/sbin/fsck.ext3
fsck.ext4 -> /usr/sbin/fsck.ext4
fsck.fat -> /usr/sbin/fsck.fat
fsck.jfs
fsck.minix -> /usr/sbin/fsck.minix
fsck.msdos -> /usr/sbin/fsck.msdos
fsck.reiserfs -> reiserfsck
fsck.vfat -> /usr/sbin/fsck.vfat
fsck.xfs -> /usr/sbin/fsck.xfs
fsfreeze -> /usr/sbin/fsfreeze
fstab-decode
fstrim -> /usr/sbin/fstrim
halt -> /usr/bin/systemctl
hdparm -> /usr/sbin/hdparm
hwclock -> /usr/sbin/hwclock
ifconfig
ifdown -> /usr/sbin/ifup
ifenslave -> /usr/sbin/ifenslave
ifplugd -> /usr/sbin/ifplugd
ifplugstatus -> /usr/sbin/ifplugstatus
ifprobe -> /usr/sbin/ifup
ifstatus -> /usr/sbin/ifup
ifup -> /usr/sbin/ifup
ifuser
init -> ../usr/lib/systemd/systemd
in.rdisc -> /usr/sbin/in.rdisc
insmod -> /usr/bin/kmod
insserv -> /usr/sbin/insserv
install-info
installkernel
install-snd-module
ip -> /usr/sbin/ip
ipmaddr
iptunnel
iscsiadm
iscsid
iscsi_discovery
iscsi_fw_login
iscsi-gen-initiatorname
iscsi-iname
iscsi_offload
iscsistart
iscsiuio
isserial
jfs_debugfs
jfs_fsck
jfs_fscklog
jfs_logdump
jfs_mkfs
jfs_tune
kdump -> /usr/sbin/kdump
kexec -> /usr/sbin/kexec
key.dns_resolver
killall5
killproc
klogd -> /usr/sbin/klogd
kpartx
ldconfig
logsave -> /usr/sbin/logsave
losetup -> /usr/sbin/losetup
lsmod -> /usr/bin/kmod
lspci
lspcmcia -> pccardctl
lvchange -> lvm
lvconvert -> lvm
lvcreate -> lvm
lvdisplay -> lvm
lvextend -> lvm
lvm
lvmchange -> lvm
lvmconf
lvmconfig -> lvm
lvmdiskscan -> lvm
lvmdump
lvmetad
lvmsadc -> lvm
lvmsar -> lvm
lvreduce -> lvm
lvremove -> lvm
lvrename -> lvm
lvresize -> lvm
lvs -> lvm
lvscan -> lvm
mdadm
mdmon
mkdosfs -> /usr/sbin/mkdosfs
mke2fs -> /usr/sbin/mke2fs
mkfs -> /usr/sbin/mkfs
mkfs.bfs -> /usr/sbin/mkfs.bfs
mkfs.btrfs -> /usr/sbin/mkfs.btrfs
mkfs.cramfs -> /usr/sbin/mkfs.cramfs
mkfs.ext2 -> /usr/sbin/mkfs.ext2
mkfs.ext3 -> /usr/sbin/mkfs.ext3
mkfs.ext4 -> /usr/sbin/mkfs.ext4
mkfs.fat -> /usr/sbin/mkfs.fat
mkfs.jfs
mkfs.minix -> /usr/sbin/mkfs.minix
mkfs.msdos -> /usr/sbin/mkfs.msdos
mkfs.nilfs2
mkfs.ntfs -> /usr/sbin/mkntfs
mkfs.reiserfs -> mkreiserfs
mkfs.vfat -> /usr/sbin/mkfs.vfat
mkfs.xfs -> /usr/sbin/mkfs.xfs
mkhomedir_helper
mkill
mkinitrd
mkinitrd_setup
mkreiserfs
mkswap -> /usr/sbin/mkswap
modinfo -> /usr/bin/kmod
modprobe -> /usr/bin/kmod
mount.cifs
mount.fuse -> /usr/sbin/mount.fuse
mount.lowntfs-3g -> /usr/bin/lowntfs-3g
mount.nfs
mount.nfs4 -> mount.nfs
mount.nilfs2
mount.ntfs -> /etc/alternatives/mount.ntfs
mount.ntfs-3g -> /usr/bin/ntfs-3g
nameif
netconfig
nfsdcltrack
nilfs_cleanerd
nologin -> /usr/sbin/nologin
OCICLI -> /usr/sbin/OneClickInstallCLI
OneClickInstallCLI -> /usr/sbin/OneClickInstallCLI
OneClickInstallUI -> /usr/sbin/OneClickInstallUrlHandler
OneClickInstallUrlHandler -> /usr/sbin/OneClickInstallUrlHandler
osd_login
pam_tally2
pam_timestamp_check
pbl
pccardctl
pidof -> killall5
pidofproc -> checkproc
pivot_root -> /usr/sbin/pivot_root
plipconfig
pmap_set2
poweroff -> /usr/bin/systemctl
purge-kernels
pvchange -> lvm
pvck -> lvm
pvcreate -> lvm
pvdisplay -> lvm
pvmove -> lvm
pvremove -> lvm
pvresize -> lvm
pvs -> lvm
pvscan -> lvm
rarp
raw -> /usr/sbin/raw
rcapparmor -> /etc/init.d/boot.apparmor
rcnetwork -> service
rcsubdomain -> rcapparmor
rcSuSEfirewall2 -> /usr/sbin/rcSuSEfirewall2
reboot -> /usr/bin/systemctl
refresh_initrd -> /usr/sbin/refresh_initrd
regdbdump -> /usr/sbin/regdbdump
reiserfsck
reiserfstune
request-key
resize2fs -> /usr/sbin/resize2fs
resize_reiserfs
rmmod -> /usr/bin/kmod
rmt
route
rpcbind
rpcinfo
runlevel -> /usr/bin/systemctl
rvmtab
service -> /usr/sbin/service
setconsole -> showconsole
setpci
set_polkit_default_privs
sfdisk -> /usr/sbin/sfdisk
showconsole
shutdown -> /usr/bin/systemctl
slattach
smart_agetty -> /usr/sbin/smart_agetty
start_daemon -> startproc
startpar
startproc
SuSEfirewall2 -> /usr/sbin/SuSEfirewall2
SUSEfirewall2 -> SuSEfirewall2
swaplabel -> /usr/sbin/swaplabel
swapoff -> /usr/sbin/swapoff
swapon -> /usr/sbin/swapon
switch_root -> /usr/sbin/switch_root
sysctl
telinit -> /usr/bin/systemctl
tracepath -> /usr/sbin/tracepath
tracepath6 -> /usr/sbin/tracepath6
tune2fs -> /usr/sbin/tune2fs
tunefs.reiserfs -> reiserfstune
udevadm -> /usr/bin/udevadm
udevd -> /usr/lib/systemd/systemd-udevd
udhcpc -> /usr/sbin/udhcpc
umount.nfs -> mount.nfs
umount.nfs4 -> mount.nfs
umount.nilfs2
unix2_chkpwd
unix_chkpwd
unix_update
update-bootloader -> pbl
update-pciids
vconfig -> /usr/sbin/vconfig
vgcfgbackup -> lvm
vgcfgrestore -> lvm
vgchange -> lvm
vgck -> lvm
vgconvert -> lvm
vgcreate -> lvm
vgdisplay -> lvm
vgexport -> lvm
vgextend -> lvm
vgimport -> lvm
vgimportclone
vgmerge -> lvm
vgmknodes -> lvm
vgreduce -> lvm
vgremove -> lvm
vgrename -> lvm
vgs -> lvm
vgscan -> lvm
vgsplit -> lvm
vhangup
wipefs -> /usr/sbin/wipefs
wiper.sh -> /usr/sbin/wiper.sh
xfsdump -> /usr/sbin/xfsdump
xfs_repair -> /usr/sbin/xfs_repair
xfsrestore -> /usr/sbin/xfsrestore
yast -> /usr/sbin/yast2
yast2 -> /usr/sbin/yast2

The etc directory contains system-wide configuration files and startup scripts (no executables should be placed here!) that we shall cover extensively in other parts of this website (click on links on files/directories for more detailed explanations):

marc:/etc> ls -logh | awk ‘{ print $7, $8, $9 }’
aclocal_dirlist
adjtime
aliases
aliases.d
alsa-pulse.conf
alternatives
apache2
apparmor
apparmor.d
appstream.conf
asound-pulse.conf
at.deny
audisp
audit
autofs_ldap_auth.conf
auto.master
auto.master.d
auto.misc
auto.net
auto.smb
avahi
bash.bashrc
bash_command_not_found
bash_completion.d
bind.keys
bindresvport.blacklist
binfmt.d
blkid.conf
bootsplash
boto-2.7.cfg
boto.cfg -> /etc/alternatives/boto.cfg
brlapi.key
brltty
brltty.conf
ca-certificates
chasenrc
chromium
cifs-utils
collectl.conf
ConsoleKit
cron.d
cron.daily
cron.deny
cron.hourly
cron.monthly
crontab
cron.weekly
crypttab
csh.cshrc
csh.login
cups
cupshelpers
dbus-1
dconf
default
defaultdomain
depmod.d
dhclient6.conf
dhclient.conf
dialogrc
DIR_COLORS
dirmngr
dleyna-renderer-service.conf
dleyna-server-service.conf
dnsmasq.conf
dnsmasq.d
dracut.conf
dracut.conf.d
drirc
enscript.cfg
environment
esd.conf
ethers
ethertypes
exports
fb-server.conf
filesystems
fonts
fstab
ftpusers
gai.conf
gconf
gdbinit
gdbinit.d
gdm
gemrc
geoclue
gimp
gnome-chess
gnome_defaults.conf
gnome-vfs-2.0
gnupg
gpm
group
group-
grub.d
gssapi_mech.conf
gtk-2.0
gtk-3.0
host.conf
hostname
HOSTNAME -> hostname
hosts
hosts.allow
hosts.deny
hosts.equiv
hosts.lpd
hosts.YaST2save
hp
hushlogins
icewm
idmapd.conf
idnalias.conf
idn.conf
ifplugd
ImageMagick-6_Q16-1
init.d
inputrc
insserv.conf
iproute2
iscsi
iscsid.conf -> iscsi/iscsid.conf
issue
issue.net
java
joe
jvm
jvm-commmon
kde4
kde4rc
krb5.conf
ksh.kshrc -> bash.bashrc
ld.so.cache
ld.so.conf
ld.so.conf.d
lesskey
lesskey.bin
lftp.conf
libao.conf
libaudit.conf
libibverbs.d
libnl
libvirt
lightdm
localtime -> /usr/share/zoneinfo/Europe/Zurich
login.defs
logrotate.conf
logrotate.d
lvm
machine-id
magic
mail.rc
manpath.config
mate_defaults.conf
mate-settings-daemon
maven
mc
mcelog
mime.types
mke2fs.conf
modprobe.d
modules-load.d
motd
mtab -> ../proc/self/mounts
mtools.conf
named.d
netconfig
netconfig.d
netgroup
NetworkManager
networks
news
nfsmount.conf
nilfs_cleanerd.conf
nscd.conf
nsswitch.conf
nsswitch.confbak
ntp.conf
ntp.keys
numad.conf
omc
openal
openldap
openvpn
opt
oraInst.loc
os-release
PackageKit
pam.d
passwd
passwd-
passwd.YaST2save
pcmcia
permissions
permissions.d
permissions.easy
permissions.local
permissions.paranoid
permissions.secure
pkcs11
pki
plymouth
polkit-1
polkit-default-privs.local
polkit-default-privs.restrictive
polkit-default-privs.standard
popt.d
postfix
ppp
pptp.d
printcap
products.d
profile
profile.d
protocols
pulse
purple
python3start
pythonstart
qemu
quilt.quiltrc
quotagrpadmins
quotatab
radvd.conf
raw
rc.d -> init.d
rc.splash
rc.status
rdma
reader.conf.d
request-key.conf
request-key.d
resolv.conf
resolv.conf.netconfig
rmt -> /sbin/rmt
rpc
rpm
rsyncd.conf
rsyncd.secrets
samba
sane.d
sasl2
screenrc
securetty
security
selinux
sensors3.conf
sensors.d
services
sgml
shadow
shadow-
shadow.YaST2save
shells
silc
skel
slp.conf
slp.reg.d
slp.spi
smartd.conf
smart_drivedb.h
smartd_warning.d
smartd_warning.sh
snapper
snmp
sound
speech-dispatcher
ssh
ssl
sudoers
sudoers.d
sudoers.dist
SUSE-brand
SUSEConnect.example
susehelp.d
SuSE-release
sysconfig
sysctl.conf
sysctl.d
sysstat
systemd
termcap -> /usr/share/misc/termcap
tmpdirs.d
tmpfiles.d
ttytype
tuned
udev
uefi
unixODBC
updatedb.conf
UPower
usb_modeswitch.conf
uucp
vconsole.conf
vdpau_wrapper.cfg
vimrc
vnc
vpnc
warnquota.conf
wgetrc
wicked
wpa_supplicant
X11
xattr.conf
xdg
xinetd.conf
xinetd.d
xml
xrdb
xscreensaver
YaST2
yp.conf
zprofile
zsh_command_not_found
zsh_completion.d
zshenv
zshrc
zypp

The contents of etc might vary slightly depending on the Linux distro you are using. For instance, RHEL / Fedora uses /etc/sysconfig to store certain configuration files that are placed elsewhere in other distributions.

The dev directory contains the special device files (or device nodes) that are built-in on connected to the system. These nodes can be character (non-buffered such as console, null, zero or tty) of block devices (e.g. buffered typical filesystem).

marc:/dev> ls -1
autofs
block
bsg
btrfs-control
bus
cdrom
cdrw
char
console
core
cpu
cpu_dma_latency
cuse
device-mapper
disk
dm-0
dm-1
dm-10
dm-11
dm-12
dm-13
dm-2
dm-3
dm-4
dm-5
dm-6
dm-7
dm-8
dm-9
dri
dvd
dvdrw
fb0
fd
full
fuse
hdd
hidraw0
hpet
hugepages
hwrng
initctl
input
kmem
kmsg
kvm
libmtp-1-2
lightnvm
log
loop-control
lp0
lp1
lp2
lp3
mapper
mcelog
mei0
mem
memory_bandwidth
mmcblk0
mmcblk0p1
mqueue
net
network_latency
network_throughput
null
nvram
port
ppp
psaux
ptmx
pts
random
rfkill
root
rtc
rtc0
sda
sda1
sda2
sda3
sda4
sda5
sdb
sdb1
sg0
sg1
sg2
shm
snapshot
snd
sr0
ssd
stderr
stdin
stdout
tty
tty0
tty1
tty10
tty11
tty12
tty13
tty14
tty15
tty16
tty17
tty18
tty19
tty2
tty20
tty21
tty22
tty23
tty24
tty25
tty26
tty27
tty28
tty29
tty3
tty30
tty31
tty32
tty33
tty34
tty35
tty36
tty37
tty38
tty39
tty4
tty40
tty41
tty42
tty43
tty44
tty45
tty46
tty47
tty48
tty49
tty5
tty50
tty51
tty52
tty53
tty54
tty55
tty56
tty57
tty58
tty59
tty6
tty60
tty61
tty62
tty63
tty7
tty8
tty9
ttyS0
ttyS1
ttyS10
ttyS11
ttyS12
ttyS13
ttyS14
ttyS15
ttyS16
ttyS17
ttyS18
ttyS19
ttyS2
ttyS20
ttyS21
ttyS22
ttyS23
ttyS24
ttyS25
ttyS26
ttyS27
ttyS28
ttyS29
ttyS3
ttyS30
ttyS31
ttyS4
ttyS5
ttyS6
ttyS7
ttyS8
ttyS9
uhid
uinput
urandom
userio
v4l
vcs
vcs1
vcs2
vcs3
vcs4
vcs5
vcs6
vcs7
vcsa
vcsa1
vcsa2
vcsa3
vcsa4
vcsa5
vcsa6
vcsa7
vfio
vga_arbiter
vhci
vhost-net
video0
watchdog
watchdog0
zero

The lib directory should contain only the libraries needed to execute the binaries in /bin and /sbin. Two sets of libraries that are very important are those for the kernel modules (placed in /lib/modules/<kernel-version-number>) and Pluggable Authentication Modules (held in /lib/security).

In systems that support 32 & 64bit binaries we might see them held separately in /lib & /lib64.

marc:/lib> ls -1
aaa_base
apparmor
cpp
dbus-1
engines
firmware
kdump
ld-2.22.so
ld-linux.so.2
ld-lsb.so.3
libacl.so.1
libacl.so.1.1.0
libanl-2.22.so
libanl.so.1
libapparmor.so.1
libapparmor.so.1.3.0
libattr.so.1
libattr.so.1.1.0
libBrokenLocale-2.22.so
libBrokenLocale.so.1
libc-2.22.so
libcap.so.2
libcap.so.2.22
libcidn-2.22.so
libcidn.so.1
libcom_err.so.2
libcom_err.so.2.1
libcrypt-2.22.so
libcrypto.so.1.0.0
libcrypt.so.1
libc.so.6
libdbus-1.so.3
libdbus-1.so.3.8.14
libdl-2.22.so
libdl.so.2
libgcc_s.so.1
libkeyutils.so.1
libkeyutils.so.1.5
libm-2.22.so
libm.so.6
libnsl-2.22.so
libnsl.so.1
libnss_compat-2.22.so
libnss_compat.so.2
libnss_db-2.22.so
libnss_db.so.2
libnss_dns-2.22.so
libnss_dns.so.2
libnss_files-2.22.so
libnss_files.so.2
libnss_hesiod-2.22.so
libnss_hesiod.so.2
libnss_mdns4_minimal.so.2
libnss_mdns4.so.2
libnss_mdns6_minimal.so.2
libnss_mdns6.so.2
libnss_mdns_minimal.so.2
libnss_mdns.so.2
libnss_nis-2.22.so
libnss_nisplus-2.22.so
libnss_nisplus.so.2
libnss_nis.so.2
libowcrypt-2.22.so
libowcrypt.so.1
libpamc.so.0
libpamc.so.0.82.1
libpam_misc.so.0
libpam_misc.so.0.82.1
libpam.so.0
libpam.so.0.84.2
libpthread-2.22.so
libpthread.so.0
libresolv-2.22.so
libresolv.so.2
librt-2.22.so
librt.so.1
libSegFault.so
libselinux.so.1
libssl.so.1.0.0
libss.so.2
libss.so.2.0
libthread_db-1.0.so
libthread_db.so.1
libutil-2.22.so
libutil.so.1
libz.so.1
libz.so.1.2.8
lsb
modules
noelision
security
udev
YaST
.
marc:/lib64> ls -1
ast
device-mapper
engines
ksh
ld-2.22.so
ld-linux-x86-64.so.2
ld-lsb-x86-64.so.3
libacl.so.1
libacl.so.1.1.0
libaio.so.1
libaio.so.1.0.1
libanl-2.22.so
libanl.so.1
libapparmor.a
libapparmor.so
libapparmor.so.1
libapparmor.so.1.3.0
libattr.so.1
libattr.so.1.1.0
libBrokenLocale-2.22.so
libBrokenLocale.so.1
libc-2.22.so
libcap.so.2
libcap.so.2.22
libcidn-2.22.so
libcidn.so.1
libcom_err.so.2
libcom_err.so.2.1
libcrypt-2.22.so
libcrypto.so.1.0.0
libcrypt.so.1
libc.so.6
libdbus-1.so.3
libdbus-1.so.3.8.14
libdevmapper-event-lvm2mirror.so
libdevmapper-event-lvm2mirror.so.2.02
libdevmapper-event-lvm2raid.so
libdevmapper-event-lvm2raid.so.2.02
libdevmapper-event-lvm2snapshot.so
libdevmapper-event-lvm2snapshot.so.2.02
libdevmapper-event-lvm2.so.2.02
libdevmapper-event-lvm2thin.so
libdevmapper-event-lvm2thin.so.2.02
libdevmapper-event.so.1.02
libdevmapper-event.so.1.03
libdevmapper.so.1.02
libdevmapper.so.1.03
libdl-2.22.so
libdl.so.2
libdmraid-events-isw.so
libdmraid-events-isw.so.1.0.0.rc16-3
libdmraid.so.1.0.0.rc16-3
libe2p.so.2
libe2p.so.2.3
libext2fs.so.2
libext2fs.so.2.4
libfipscheck.so.1
libfipscheck.so.1.1.0
libfreebl3.chk
libfreebl3.so
libfreeblpriv3.chk
libfreeblpriv3.so
libfuse.so.2
libfuse.so.2.9.3
libgcc_s.so.1
libgssglue.so.1
libgssglue.so.1.0.0
libhistory.so.6
libhistory.so.6.3
libkeyutils.so.1
libkeyutils.so.1.5
libkmod.so.2
libkmod.so.2.2.7
liblvm2app.so
liblvm2app.so.2.2
liblvm2cmd.so
liblvm2cmd.so.2.02
libm-2.22.so
libm.so.6
libmvec-2.22.so
libmvec.so.1
libncurses.so.5
libncurses.so.5.9
libncurses.so.6
libncurses.so.6.0
libncursesw.so.5
libncursesw.so.5.9
libncursesw.so.6
libncursesw.so.6.0
libnsl-2.22.so
libnsl.so.1
libnsl.so.2
libnsl.so.2.0.0
libnss_compat-2.22.so
libnss_compat.so.2
libnss_db-2.22.so
libnss_db.so.2
libnss_dns-2.22.so
libnss_dns.so.2
libnss_files-2.22.so
libnss_files.so.2
libnss_hesiod-2.22.so
libnss_hesiod.so.2
libnss_mdns4_minimal.so.2
libnss_mdns4.so.2
libnss_mdns6_minimal.so.2
libnss_mdns6.so.2
libnss_mdns_minimal.so.2
libnss_mdns.so.2
libnss_nis-2.22.so
libnss_nisplus-2.22.so
libnss_nisplus.so.2
libnss_nis.so.2
libowcrypt-2.22.so
libowcrypt.so.1
libpamc.so.0
libpamc.so.0.82.1
libpam_misc.so.0
libpam_misc.so.0.82.1
libpam.so.0
libpam.so.0.84.2
libpci.so.3
libpci.so.3.2.1
libpthread-2.22.so
libpthread.so.0
libreadline.so.6
libreadline.so.6.3
libresolv-2.22.so
libresolv.so.2
librt-2.22.so
librt.so.1
libSegFault.so
libselinux.so.1
libsepol.so.1
libssl.so.1.0.0
libss.so.2
libss.so.2.0
libthread_db-1.0.so
libthread_db.so.1
libtinfo.so.5
libtinfo.so.5.9
libtinfo.so.6
libtinfo.so.6.0
libtirpc.so.3
libtirpc.so.3.0.0
libunwind.so.8
libunwind.so.8.0.1
libustr-1.0.so.1
libustr-1.0.so.1.0.4
libutil-2.22.so
libutil.so.1
libwrap.so.0
libwrap.so.0.7.6
libz.so.1
libz.so.1.2.8
noelision
security

The media directory (or /run/media/<username> in SUSE/RedHat) is used as a mount point for removable media such as CDs, DVDs, USB drives or SD cards.

The mnt directory is often used for networked filesystems (NFS, Samba, CIFS, etc).

The usr directory contains those binaries deemed non-essential or only used by non-root users. It is a good practice to segregate /usr on its own filesystem as it might be substantially larger and more prone to change than /bin and /sbin.

marc:/usr> ls -logh
total 304K
drwxr-xr-x   2  76K Mar 17 12:53 bin
drwxr-xr-x   2 4.0K Feb 21 22:20 games
drwxr-xr-x 103  12K Mar 15 19:47 include
drwxr-xr-x   3 4.0K Feb 22 18:08 java
drwxr-xr-x 120  16K Mar 17 12:53 lib
drwxr-xr-x 193 132K Mar 17 12:53 lib64
drwxr-xr-x  11 4.0K Feb 21 20:57 local
drwxr-xr-x   2  20K Mar 17 12:53 sbin
drwxr-xr-x 357  12K Mar 15 19:47 share
drwxr-xr-x   6 4.0K Feb 21 22:24 src
lrwxrwxrwx   1   10 Feb 21 20:57 tmp -> ../var/tmp
drwxr-xr-x   3 4.0K Feb 21 20:57 X11R6
drwxr-xr-x   5 4.0K Feb 21 20:57 x86_64-suse-linux

The opt directory is used by software packages that wish to keep all their files in one isolated place rather than scattered system-wide. With the popularisation of package management tools (rpm, zypper, yum, apt-get, etc) this need is far less important than in the past so /opt is used far less. However, if your environment uses software installed in /opt, you might want to segregate it into a separate filesystem.

The var directory is meant for variable or volatile data such as log files, spool directories, email queues or caches. In busy servers the space utilisation of /var might grow a lot and fast, so for the sake of stability and availability it is highly recommended to again segregate it into a separate filesystem with generous space allocation.

marc:/var> ls -logh
total 56K
drwxr-xr-x 10 4.0K Feb 21 21:25 adm
lrwxrwxrwx  1   11 Feb 21 22:22 agentx -> /run/agentx
drwxr-xr-x 17 4.0K Feb 22 18:11 cache
drwxr-xr-x  2 4.0K May 10  2017 crash
drwxr-xr-x  3 4.0K Mar 15 19:47 games
drwxr-xr-x 63 4.0K Mar 15 19:47 lib
lrwxrwxrwx  1    9 Feb 21 20:57 lock -> /run/lock
drwxr-xr-x 19 4.0K Mar 17 12:53 log
drwx——  2  16K Feb 21 20:56 lost+found
lrwxrwxrwx  1   10 Feb 21 20:57 mail -> spool/mail
drwxr-xr-x  2 4.0K May 10  2017 opt
lrwxrwxrwx  1    4 Feb 21 20:57 run -> /run
drwxr-xr-x 13 4.0K Feb 21 21:17 spool
drwxrwxrwt 15 4.0K Mar 17 17:12 tmp
drwxr-xr-x  3 4.0K Feb 21 21:14 yp

The tmp directory is in modern distros a tmpfs filesystem that uses RAM rather than disk. If we are short on RAM or simply do not want it consumed this way, we can create and mount a permanent filesystem (e.g. ext4 or xfs) on /tmp in the /etc/fstab. As its name implies, contents placed in this directory are temporary in nature and might be wiped out upon reboot or by some cron cleanup scripts.

The home directory is the place we find by default all non-root HOME user directories and their contents. It is strongly advised to have this directory on its own filesystem to prevent users filling up the “/” filesystem!

The root directory is the HOME folder for root and is most often part of the “/” filesystem because it rarely uses much storage.

The boot directory is normally in its own small filesystem of a few hundred Mbytes formatted as FAT or EXT2. It must contain two files that are essential for Linux:

vmlinuz: this is the compressed Linux kernel

initrd or initramfs: mounted before the real root filesystem is available

marc:/boot> ls -logh
total 31M
-rw-r–r– 1  1.7K May 17  2017 boot.readme
-rw-r–r– 1  176K Feb  7 00:24 config-4.4.114-42-default
drwxrwxr-x 3   16K Jan  1  1970 efi
drwxr-xr-x 7  4.0K Mar 17 12:53 grub2
lrwxrwxrwx 1    25 Feb 21 21:12 initrd -> initrd-4.4.114-42-default
-rw——- 1   13M Mar 17 12:53 initrd-4.4.114-42-default
-rw-r–r– 1  191K May 10  2017 memtest.bin
-rw-r–r– 1  491K Feb 21 21:04 message
-rw-r–r– 1  974K Feb  7 00:53 symtypes-4.4.114-42-default.gz
-rw-r–r– 1  334K Feb  7 00:52 symvers-4.4.114-42-default.gz
-rw-r–r– 1   377 Feb  7 00:52 sysctl.conf-4.4.114-42-default
-rw-r–r– 1  3.2M Feb  7 00:49 System.map-4.4.114-42-default
-rw-r–r– 1  6.8M Feb  7 00:54 vmlinux-4.4.114-42-default.gz
lrwxrwxrwx 1    26 Feb 21 21:12 vmlinuz -> vmlinuz-4.4.114-42-default
-rw-r–r– 1  5.9M Feb  7 01:29 vmlinuz-4.4.114-42-default

If we see a few versions of vmlinuz & initrd files with different numbering that means we have the possibility of booting from previous kernels. That is always a good option to have in case of problems with the latest installed kernel!

We can see 2 other files which are not a must but come in extremely useful when debugging:

System.map: kernel symbol table with the addressess of all kernel symbols in hexadecimal format

config: configuration file used when compiling the kernel

We also see the directories efi and grub2 used respectively in UEFI and BIOS booted systems:

marc:/boot> ls -logh efi/EFI/ grub2/
efi/EFI/:
total 8.0K
drwxrwxr-x 2 4.0K Feb 21 22:22 boot
drwxrwxr-x 2 4.0K Feb 21 23:17 opensuse
grub2/:
total 44K
drwxr-xr-x 2 4.0K May 18  2017 backgrounds
drwxr-xr-x 2 4.0K Feb 21 21:22 fonts
-rw——- 1 9.0K Mar 17 12:53 grub.cfg
-rw-r–r– 1 1.0K Feb 21 21:22 grubenv
drwxr-xr-x 2 4.0K Mar 15 18:27 locale
drwxr-xr-x 3 4.0K Feb 21 21:11 themes
drwxr-xr-x 2  12K Mar 15 18:27 x86_64-efi

There are 3 more filesystems called run, proc & sys that are of interest. The 3 of them are pseudo-filesystems that use memory rather than disk as storage medium.

The run filesystem is used for volatile files that do not need to be persisted across reboots and need fast access. Good examples would be lock or PID files or files used for inter-process coordination.

The proc and sys pseudo-filesystems are explained more in detail in the Monitoring section.

 

<< root password recovery