Skip to main content
  1. Data Science Blog/

Linux OS Directories

·902 words·5 mins· loading · ·
IT Infrastructure System Administration Linux Operating Systems System Administration System Architecture Learning Resources

On This Page

Table of Contents
Share with :

Linux OS Directories

Linux OS Directories
#

Linux OS Folders and the purpose.

Introduction:
#

Linux is a widely used operating system that is known for its flexibility and versatility. One of the unique features of Linux is its file system hierarchy, which is organized into a many directories that serve specific purposes. Folder structure of Unix OS and all distributions of Linux is same. Each directory has its own set of files and subdirectories that are used to manage various aspects of the operating system and data folders.

I have seen many people struggle to understand what goes inside what folder on the Linux OS. In this article, we will explore the purpose of each directory in Linux and gain a better understanding of how the file system hierarchy works.

A typical Linux filesystem includes the following high-level directories, each serving specific purposes. These directories are part of the Filesystem Hierarchy Standard (FHS) which defines the directory structure and directory contents in Unix and Unix-like operating systems. This standard helps ensure consistency and predictability across different Linux distributions.

Software - Core
#

  1. /boot: Contains the files required for booting the system (e.g., kernel, initrd).
  2. /sbin: Contains essential system binaries (e.g., init, shutdown, ifconfig, etc.).
  3. /bin: Contains essential user binaries (executable programs) needed for system boot and for users. (e.g., ls, cp, mv, rm, etc.).
  4. /dev: Holds device files, which are special files that represent hardware devices and peripherals (e.g., disks, printers, keyboards, etc.). Examples include /dev/sda (a hard drive) and /dev/tty (terminals).
  5. /etc: Contains configuration files for the system and installed applications (network configuration, user account information, etc.). Examples include /etc/passwd (user account information) and /etc/fstab (filesystems to be mounted at boot).
  6. /sys: A virtual filesystem that provides information about devices, drivers, and kernel features. Similar to /proc, but focused more on the hardware.
  7. /lib: Contains shared libraries needed by essential system binaries to run, these binaries are located in /bin and /sbin. Examples include libraries for C standard functions.
  8. /lib64: Contains 64-bit libraries on systems that support both 32-bit and 64-bit applications.

Software Hardware Attached
#

  1. /media: Mount point for removable media devices (e.g., USB drives, CDs, DVDs, etc.). Designed for automatically mounting removable media such as CDs, DVDs, USB drives, and other portable devices. Commonly used by desktop environments and other software to automatically mount and unmount removable media. Mount points under /media are often automatically created and managed by the operating system or desktop environment when removable media is inserted. For example, when you insert a USB drive, it might automatically mount to /media/username/USB_DRIVE_LABEL.
  2. /mnt: Mount point for temporarily mounted filesystems. Typically used by system administrators for manual mounts, such as mounting external drives, network shares, or other filesystems temporarily. You might manually mount a network share to /mnt/network or an external USB drive to /mnt/usb. /mnt/usb is used as a manual mount point for a USB drive. command: sudo mount /dev/sdb1 /mnt/usb

Software Installed
#

  1. /opt: Contains optional software packages.
  2. /local: Contains locally installed software that is not part of the core system.
  3. /usr: Contains user utilities and applications (e.g., compilers, editors, games, etc.). It contains user binaries, libraries, documentation, and source code. It is typically divided into subdirectories like bin (additional user binaries), lib (libraries for user binaries), and share (shared data).

System Related Data#

  1. /var: Contains variable data files, such as logs, databases, email spools, and transient and temporary files. Examples include /var/log for log files and /var/spool for mail and printer spool files.
  2. /proc: A virtual filesystem that provides a mechanism to access kernel and process information. Files here represent the current state of the system. For example, /proc/cpuinfo contains information about the CPU. (e.g., running processes, kernel configuration, etc.).
  3. /run: Contains system runtime data (e.g., process IDs, socket files, etc.).
  4. /srv: Contains data for services provided by the system (e.g., web server data).
  5. /tmp: A directory for temporary files that are often cleared on reboot. Applications use this directory to store temporary data.

User/Admin Data
#

  1. /root: Home directory for the root user.
  2. /home: Contains the home directories for regular users. For instance, a user named “hari” would have a home directory at /home/hari.

How to access Linux in Windows Environment?
#

Without the headache of maintaining traditional virtual machine or without maintaining dualboot setup there are two ways:

A. You can install WSL (windows subsystem for linux) on windows machine. Then within the windows environment you can run WSL and then excute linux command.

B. You can start a docker container. For this you need to have docker desktop installed on your machine. Then run the docker. Next you need to pull “busybox” a popular linux image in docker from docker hub to your desktop docker. Finally you need to run this image in some container within the docker. For details, read docker busybox.

Conclusion:
#

In conclusion, the file system hierarchy in Linux is a complex and well-organized system that serves a specific purpose for each directory. Understanding the purpose of each directory is crucial for managing and using Linux effectively. Whether you are a beginner or an advanced user, having a good understanding of the file system hierarchy will help you navigate the system with ease and perform tasks more efficiently.

With this knowledge, you can better understand how the various parts of the Linux operating system work together and gain a deeper appreciation for the power and flexibility that Linux provides.

Dr. Hari Thapliyaal's avatar

Dr. Hari Thapliyaal

Dr. Hari Thapliyal is a seasoned professional and prolific blogger with a multifaceted background that spans the realms of Data Science, Project Management, and Advait-Vedanta Philosophy. Holding a Doctorate in AI/NLP from SSBM (Geneva, Switzerland), Hari has earned Master's degrees in Computers, Business Management, Data Science, and Economics, reflecting his dedication to continuous learning and a diverse skill set. With over three decades of experience in management and leadership, Hari has proven expertise in training, consulting, and coaching within the technology sector. His extensive 16+ years in all phases of software product development are complemented by a decade-long focus on course design, training, coaching, and consulting in Project Management. In the dynamic field of Data Science, Hari stands out with more than three years of hands-on experience in software development, training course development, training, and mentoring professionals. His areas of specialization include Data Science, AI, Computer Vision, NLP, complex machine learning algorithms, statistical modeling, pattern identification, and extraction of valuable insights. Hari's professional journey showcases his diverse experience in planning and executing multiple types of projects. He excels in driving stakeholders to identify and resolve business problems, consistently delivering excellent results. Beyond the professional sphere, Hari finds solace in long meditation, often seeking secluded places or immersing himself in the embrace of nature.

Comments:

Share with :

Related

What is a Digital Twin?
·805 words·4 mins· loading
Industry Applications Technology Trends & Future Computer Vision (CV) Digital Twin Internet of Things (IoT) Manufacturing Technology Artificial Intelligence (AI) Graphics
What is a digital twin? # A digital twin is a virtual representation of a real-world entity or …
Frequencies in Time and Space: Understanding Nyquist Theorem & its Applications
·4103 words·20 mins· loading
Data Analysis & Visualization Computer Vision (CV) Mathematics Signal Processing Space Exploration Statistics
Applications of Nyquists theorem # Can the Nyquist-Shannon sampling theorem applies to light …
The Real Story of Nyquist, Shannon, and the Science of Sampling
·1146 words·6 mins· loading
Technology Trends & Future Interdisciplinary Topics Signal Processing Remove Statistics Technology Concepts
The Story of Nyquist, Shannon, and the Science of Sampling # In the early days of the 20th century, …
BitNet b1.58-2B4T: Revolutionary Binary Neural Network for Efficient AI
·2637 words·13 mins· loading
AI/ML Models Artificial Intelligence (AI) AI Hardware & Infrastructure Neural Network Architectures AI Model Optimization Language Models (LLMs) Business Concepts Data Privacy Remove
Archive Paper Link BitNet b1.58-2B4T: The Future of Efficient AI Processing # A History of 1 bit …
Ollama Setup and Running Models
·1753 words·9 mins· loading
AI and NLP Ollama Models Ollama Large Language Models Local Models Cost Effective AI Models
Ollama: Running Large Language Models Locally # The landscape of Artificial Intelligence (AI) and …