Linux is very very large and complex. It has tons of files to do loads of work. Files are stored in a structured way distributed on its working and its further sub-working.It is done so to maintain such a large codebase for further developmet and efficient working of kernel. Remember everthing in linux is a file(even a device or a virtual device), later you will see.
Linux File system has a heirarchy layout in directories(silmilar to folder in windows os).File heirarchy is defined in linux. Learner from windows might feel awkward but it is simple tree in which files are stored. Every directories in linux has a specific role to play,its children directories are attached to its parent directory. ' / ' is considered as prime directory also called root directory . It means it is the top most directory of whole file system and all the other directory will be child of root. It is maintained in tree structure. Every directory has certain exclusive type of data and role to operate the os.
Various directory in linux and its role :
/ : This is the root directory. This is where the whole tree starts. ,
1. /bin : All the executable binary programs (file) required during booting, repairing, files required to run into single-user-mode. It contains all the basic program like cat,cd etc.
2. /boot : Holds important files during boot-up process, it includes Linux Kernel.
3. /dev : Linux shows devices as files, and the /dev directory contains a number of special files that represent devices. These are not actual files as we know them, but they appear as files – for example, /dev/sda represents the first SATA drive in the system(hard disk), /dev/sdb for usb device .
This directory also contains pseudo-devices, which are virtual devices that don’t actually correspond to hardware, these are virtual hardware on system. For example, /dev/random produces random numbers. /dev/null is a special device that produces no output and automatically discards all input – when you pipe the output of a command to /dev/null. e.g., cdrom, cpu, etc
4. /etc : It Contains system's application configuration files like startup, shutdown, down, up script etc.
5. /home : Home directory of the users. Every time a new user is created, a directory in the name of user is created within home directory which contains other directories like Desktop, Downloads, Documents,Music etc.User can create its directories and files in here. User specific configuration files are located in home directory only.
6. /lib : The Lib directory contains kernel modules and shared library images required to boot the system and run commands in root file system and links. /bin binaries uses these libraries to operate its functions.
7. /lost+found : This Directory is installed during installation of Linux, useful for recovering files which may be broken due to unexpected shut-down.
8. /media : SUb-directory is created when a removal media is plugged or mounted to system like /media/usb_name , /media/cdrom etc
9. /mnt : Temporary mount point for fie systems like a partion of windows already on that system. although it can be mounted anywhere if user wants by giving proper path.
10. /opt : Optional application who donot follow the standard file heirarchy like proprietry programs. Contains third party application software.Ex - Java,vagrant etc.
11. /proc : The /proc directory similar to the /dev directory because it doesn’t contain standard files. It contains special files that represent system and process information.
12. /root : This is the home directory of root user and should never be confused with ‘/‘. root user are priveleged users who has freedom to do any execution on that system.
13. /run : This directory is used for storing process id and sockets etc while starting of system , else /var/run/ is used afterwards by user applications to store temporary pid's and sockets endpoint.
14. /sbin : The /sbin directory is similar to the /bin directory. It contains essential binaries that are generally intended to be run by the root user for system administration.
15. /srv : Service is abbreviated as ‘srv‘. This directory contains site-specific data that is served by this system.
16. /sys : Linux include a /sys directory as a virtual filesystem which exports information about various kernel subsystems. It alse stores and allows modification of the devices connected to the system.
17. /tmp :System’s Temporary Directory, which gets wiped out after every reboot or may be by any utility such as tmpwatch.
18. /usr : The /usr directory contains applications and files used by users. The /usr directory also contains other directories – for example, architecture-independent files like graphics are located in /usr/share.The /usr/local directory is where locally compiled applications installs by default – this prevents them from messing up the rest of the system.
19. /var : Variable directory contains log, mail and temp files.
Learner can find more about it by man pages. run command : "man hier" .