Friday, June 25, 2021

Linux Directory Structure

Overview

The purpose of this guide will provide insight into a typical Linux Directory Structure.

DirectoryDescription
/ (root filesystem) A simple forward slash denotes the root directory that contains all the other user-specific and global sub-directories;
Primary hierarchy root
and root directory of the entire file system hierarchy;
The root filesystem is the top-level directory of the filesystem.

It contains all of the files required to boot the Linux server before other filesystems are mounted.
It must include all of the required executables and libraries required to boot the remaining filesystems.
After the server is booted, all other filesystems are mounted on standard;
All other mount points are mounted as subdirectories of the root filesystem.
After the system is booted, all other filesystems are mounted on standard; a well-defined mount points as subdirectories of the root filesystem.
/bin Stands for binaries (binary exectuables);
This folder contains base executables which are required for minimal server working;
These commands are available in runlevel 1 for basic administration;
These commands are available for all the users on the server;

The /bin directory contains server executable files;
It's also called in-built commands, which means addtional packages are not required for running these commands;
Few commands are cat, chown, chgrp, date, mv, echo and few compression tools.
/sbin System binary files. These are executables are used for server administration;
It's also called "super user" binaries;
If you want execute a command as normal user ; you have to configure SUDO or
implement PowerBroker application /appliance (third-party) to give elevated access to a user(s).
Example commands are dhcpclient, fsck, chkconfig or systemctl, pbrun.
/boot The boot directory stores the kernel of the Linux system as well as the files related to the boot loader;
This directoy contains static bootloader and kernel executable and configuration files required to boot a Linux server;
Boot loader files, kernel, initrd;
is stored on this partition.
/dev Directory contains device files for every hardware device attached to the system;
These are not device drivers, rather they are files that represent each device on the server and facilitate access respective devices;
This directory contains devices in the form of files that are available to the system. You can read or write in these files/devices;
For example /dev/fd0 represents floppy disks, /dev/sda represents hard drives, etc; essential devices, for example /dev/null;
These are not device drivers, rather they are files that represent each device on the computer and facilitate access respective devices.
/proc This directory contains all the process information running on the server;
It's a virtual directory that contains entries corresponding to the processes that are runing.
/etc This directory contain system configuration files of the server;
It contains files such as passwd which stores information related to each user;
/etc/passwd which has details regarding the users on the servers;
/etc/fstab 
which has details regarding the mounted devices;
/etc/hosts which contains details regarding the hostnames that the system recognizes,;
/etc/init.d which has information related to scripts that is used to start system related services during boot;
All the configurations are located in folder /etc, it can be changed; for example /etc/opt/ , /etc/xml/.
/home It's the home directory of system's user(s) and storage for user data & files;
Each user has a subdirectory in /home if not explicitly created elsewhere;
For example /home/vcp.muthukrishna, /home/user1.
/lib This folder contains shared library files that are required to boot the server.
/media This directory is temporary location, that's utilized to mount external & removable media devices;
Its utilized to access a files stored in the devices, though it has to be first mounted;
During the boot, the kernel reads the /etc/fstab file to look for mounting instructions for permanent drives.
For temporary mounts like CD, USBs, etc., /mnt or /media directory could be utilized.
It's also a location for different types of removable devices such as CD-ROM or ISO.
/mnt Its same location as /media mount point, a temporary location for for regular filesystems (as in not removable media) that can be used while the administrator is repairing or working on a filesystem;
When the system is rebooted these mount point(s) will be unmounted;
It's not a removable media such as USB or external storage media (cd, dvd, external disk).
/opt Optional folder / files wherein third party / vendor's application programs are typically installed in this directory;
Applications such as Java, etc. It abbreviated for optional.
/root It is the home directory for the root user;
Note: This is not the root (/) filesystem.
/tmp OS's temporary storage and different applications store temporary files in this folder;
Users also can store files in this folder temporarily;
Most important aspect is that it could be deleted at any point or time.
/usr This folder contains are shareable, read-only files, including executable binaries and libraries;
man (help) files
, and other types of documentation.
/var Variable data files are stored in this location.
System logs and most applicaition log files are logged into their respective log files;
temporary files /var/tmp, often not preserved between system reboots;
For example: messages, dmesg, MySQL, apache webserver, log files.
/srv It abbreviates for service and contains files that are specific to services.
/usr/bin It's similar to "/bin" folder;
/usr/bin directory contains user's normal executable files;
It’s extended set of commands to /bin folder, its not very much required to run the server /but a good to have commands;
To execute these commands require additional packages has to be installed, e.g. nmap; commands are at, awk, cal, nmap, who, unzip, iostat.
/usr/sbin It's similar to "/sbin" folder;
/usr/sbin directory contains system executable files;
It’s extended set of commands to /sbin folder, its not very much required to run the server;
Few commands require additional packages has to be installed, e.g. tcpdump; commands are arp, adduser, cron, tcpdump.
/usr/<local>/bin Third party tools or applications will contain their respective binaries, these binaries are also available for users
to execute for normal users;
set of commands to /usr/<appln>/bin folder.
/usr/<local>/sbin Third party tools or applications will contain their respective binaries stored, these binaries are also available for users
to execute to manage the application (administration).
set of commands to /usr/<appln>/sbin folder.

No comments:

Post a Comment