In this tutorial we will look details about Linux file system and directories. Linux stores binaries, files, images, libraries etc. in the file system for persistence. Ram is cleared between reboots but file system stays same if there is no change made intentionally.
Root File System
Linux file system hierarchy is leveled. So on the top of file system tree root path. All other files and directories are under this root path. For example if a usb is mounted which means connected to the Linux system it will exists generally in /media/<username>/<usb name> like /media/ismail/myusb .
File is container for data like binary, image, text, dll etc. File have no child.We can list files like below
$ ls -l total 40 -rw-rw-r-- 1 ismail ismail 253 Nov 13 18:25 mycommand drwxrwxr-- 3 ismail ismail 4096 Nov 13 15:59 output -rw-rw-r-- 1 ismail ismail 6350 Sep 20 14:51 percona-release_0.1-4.xenial_all.deb -rw-rw-r-- 1 ismail ismail 5127 Nov 13 12:03 pnggrad8rgb.jpg
- Except output all of them are files
- output is directory
Directory hold files and child directories and used as holder for these items. Directory have no data.
$ ls -ld drwxr-xr-x 6 ismail ismail 4096 Nov 15 11:27 .
Directories and Their Meaning
Where is binary files stored? How can I change some configuration of applications? Where are my logs? We will look general usage of the directories
- / root path and holds all other paths
- /usr , /bin user related binaries hold in these paths
- /sbin administrator related paths are hold here
- /opt third party installed applications lays here
- /etc configuration files are hold here
- /var/log log files are saved acording to their application
- /home user home directories and desktops are created here
- /root ultimte administrator root’s home directory is here
- /lib libraries requred to run applications
- /media mount point for media like usb
- /mnt mount point for temporary mounted file systems
- /tmp temporary files
- /var variable files like log, spool
- /var/www web server apache2 default directory