In this lesson, we will focus on Linux File System. We will learn what is Linux File System? The files that resides in this file system one by one.
Table of Contents
Linux has different directories. These directory structure are defined by Linux File System Hierarchy Standard (FHS). All these directories are defined under the root directory (/). Some of these directories are standard and some of them are added according to the installed sub systems. Here, we will focus on File System of Linux and we will learn what is Linux File System detailly.
We will cover common directories during the explanation of what is Linux File System. These directories are given below:
Now, let’s focus on each of these directories used in Linux File System and learn what are they.
You can download Linux Cheat Sheet and you can test yourself on Linux Commands Questions Page!
The main answer of what is Linux File System quesiton is Root directory. Root directory (/) is the top of the all directories in this File System. All the other directories are connected to this directory. Only root user has write permission under root directory (/).
Below, you can see the directories under root directory in kali Linux.
kali@kali:/$ ls
bin dev home initrd.img.old lib32 libx32 media opt root sbin sys usr vmlinuz
boot etc initrd.img lib lib64 lost+found mnt proc run srv tmp var vmlinuz.old
There are different binary programs that are needed during booting, upgrading, repairing etc. The executable binary programs are stored in /bin directory. It is also the directory of the basic Linux commands.
Below, you can see some parts of the content of /bin directory:
kali@kali:/bin$ ls
…
atobm gunzip pager systemd-resolve
attr guymager pa-info systemd-run
autoexpect gv2gml pamon systemd-socket-activate
automat-visualize3 gv2gxl paperconf systemd-stdio-bridge
autopasswd gvcolor paplay systemd-sysusers
autopsy gvgen parec systemd-tmpfiles
awk gvmap parecord systemd-tty-ask-password-agent
axel gvmap.sh parole systemd-umount
b2sum gvpack parse-edid sz
base32 gvpr partx tabs
base64 gxl2dot passmass tac
basename gxl2gv passwd tail
bash gzexe paste tapestat
…
/boot directory holds the important files for boot-up process. In other words it includes boot loader files. It is one of the other answer of what is Linux File System question.
Below, you can see the content of /boot directory.
kali@kali:/boot$ ls
config-5.4.0-kali2-amd64 grub initrd.img-5.4.0-kali3-amd64 System.map-5.4.0-kali3-amd64 vmlinuz-5.4.0-kali3-amd64
config-5.4.0-kali3-amd64 initrd.img-5.4.0-kali2-amd64 System.map-5.4.0-kali2-amd64 vmlinuz-5.4.0-kali2-amd64
/dev directory includes all the device files. These devices can be any physical devices like cpu, usb, storages etc.
Below you can see some parts of the content of /dev directory.
kali@kali:/dev$ ls
agpgart cpu_dma_latency hidraw1 mqueue rfkill snd tty13 tty23 tty33 tty43 tty53 tty63 vcs vcsa3 vcsu6
autofs cuse hpet net rtc sr0 tty14 tty24 tty34 tty44 tty54 tty7 vcs1 vcsa4 vcsu7
block disk hugepages null rtc0 stderr tty15 tty25 tty35 tty45 tty55 tty8 vcs2 vcsa5 vfio
bsg dmmidi initctl nvram sda stdin tty16 tty26 tty36 tty46 tty56 tty9 vcs3 vcsa6 vga_arbiter
…
/etc directory is another important directory of Linux File System. This file contains configuration files of the applications and different start and stop scritpts.
kali@kali:/etc$ ls
adduser.conf default hosts localtime openvpn request-key.conf subgid-
adjtime deluser.conf hosts.allow logcheck opt request-key.d subuid
alsa dhcp hosts.deny login.defs os-release resolv.conf subuid-
alternatives dictionaries-common idmapd.conf logrotate.conf PackageKit resolvconf subversion
apache2 discover.conf.d ifplugd logrotate.d pam.conf responder sudoers
…
/home is the home directory of all users. Each user’s personal files are stored in this directory in Linux Directory System. /home directory contains user directories like downloads, documents, desktop etc.
/lib directory contains library files that support binaries that resides in /bin and /sbin. Kernel modules and shared library images are also stored here.
kali@kali:/lib$ ls
apache2 file libDeployPkg.so.0 libvmtools.so.0 pppd
apparmor firefox-esr libDeployPkg.so.0.0.0 libvmtools.so.0.0.0 proxychains3
apt firmware libdiscover.so.2 linux-boot-probes pulse-13.0
arj galera libdiscover.so.2.0.1 llvm-8 python2.7
aspell gcc libdlrpc.so locale python3
….
/media directory is used as a temporary mount directory for removable devices. For example, this can be a cdrom.
ali@kali:/media$ ls
cdrom cdrom0
/mnt directory is the temporary directory where we can mount filesystems in Linux Directory systems.
/opt directory contains the 3th party applications. These applications can be installed directly under /opt or under any other sub directory under /opt.
/srv directory contains server specific services data. Srv is the abbreviation of service.
/sbin is the directory in Linux directory systems that includes system binary executable programs. This can be ifconfig, reboot, iptables, init, route etc.
Some part of the /sbin directory content is given below:
kali@kali:/sbin$ ls
a2disconf e2label ip6tables-nft-restore nftl_format sm-notify
a2dismod e2mmpstatus ip6tables-nft-save nginx snmpd
a2dissite e2scrub ip6tables-restore nmbd split-logfile
a2enconf e2scrub_all ip6tables-restore-translate nologin sshd
a2enmod e2undo ip6tables-save ntfsclone ssldump
a2ensite e4crypt ip6tables-translate ntfscp sslh
a2query e4defrag ipmaddr ntfslabel sslh-select
/sys directory includes virtual filesystem that stores the modifications that we do on the connected devices.
kali@kali:/sys$ ls
block bus class dev devices firmware fs hypervisor kernel module power
/tmp directory is another directory used in Linux File System. /tmp directory stores temporary files of the user and the system. After a reboot it id deleted. In other words, it stores the files between reboots.
kali@kali:/tmp$ ls
ssh-9PRk0TbKpfXN
systemd-private-438ccfd1b3cc45c29360c9e07e301483-colord.service-Nom75M
systemd-private-438ccfd1b3cc45c29360c9e07e301483-haveged.service-VSbA2Z
systemd-private-438ccfd1b3cc45c29360c9e07e301483-ModemManager.service-fZtQMG
systemd-private-438ccfd1b3cc45c29360c9e07e301483-systemd-logind.service-jliJ45
systemd-private-438ccfd1b3cc45c29360c9e07e301483-upower.service-HKYMJ8
VMwareDnD
vmware-root_564-2965382482
/usr directory contains executable libraries, documentation, binaries for second level program.
kali@kali:/usr$ ls
bin games include lib lib32 lib64 libexec libx32 local sbin share src
/proc directory is another directory of Linux File System. It includes the system process information. It is a virtual filesystem with tect information about system resoruces.
/var directory stores all variable files and temporary files created by users. For examle this can be a log file.
kali@kali:/var$ ls
backups cache lib local lock log mail opt run spool tmp www
In this lesson, we have talked about what is Linux File System detailly with the main Linux File directories. You will use these directories in your Linux System Administration.
Leave a Reply