[Day 1] 5. Linux File Structure
!5. Linux File Structure.png
Linux File Structure
In Linux, the file system follows a tree-like structure starting from the root directory, denoted by
/Key Directories in Linux
-
/boot directory:
- Contains booting information.
- The Linux kernel and initial RAM disk are stored here.
-
/bin directory:
- Stores essential binary files (executables).
- Contains basic command executables like ,
ls, etc.cat
-
/sbin directory:
- Contains binaries that only the superuser (root) can execute.
- "S" stands for super (root user).
-
/etc directory:
- Holds configuration files for the system.
- Contains settings for the hostname, users, networks, etc.
-
/root directory:
- Home directory for the root user.
-
/home directory:
- Contains home directories for users other than the root user.
- For example, directories for users like "ditiss" and "sunbeam" are stored here, with appropriate permissions.
-
/media directory:
- Stores information about removable devices (e.g., pen drives, external hard disks).
-
/mnt directory:
- Used for manually mounting removable devices.
- A sub-directory of .
/media
-
/tmp directory:
- Stores temporary files. These files are deleted automatically when the system is turned off.
-
/var directory:
- Stores variable data files.
- For example, log files, such as , where the kernel logs system messages.
/var/log/messages
-
/usr directory:
- Stores user application data.
- Sub-directories include:
- : User binaries.
bin - : System binaries for administrative tasks.
sbin - : System libraries.
lib - : Documentation and shared resources for applications.
share
-
/lib directory:
- Contains system libraries used by executables in and
/bin./sbin
- Contains system libraries used by executables in
-
/opt directory:
- Stores data for third-party applications installed outside the default package management.
-
/dev directory:
- Stores device files. In Linux, even hardware devices (e.g., pen drives, printers) are treated as files.
-
/proc directory:
- Contains information about all running processes and system information.
- This directory provides a virtual file system interface to kernel data structures.
-
/sys directory:
- Contains kernel module information and details about device drivers.
Special Directories
- /dev, /proc, and /sys:
- These directories exist only in RAM and are created dynamically during boot.
- They are known as virtual directories or virtual file systems because they are not stored on the hard disk.
Path:
A path in Linux represents a file or directory’s unique location. Paths are separated by
/Types of Paths
-
Absolute Path:
- Always starts from the root ().
/ - Example: .
/home/ditiss/python/demos/demo01.py
- Always starts from the root (
-
Relative Path:
- Starts from the current working directory.
- Example: If you’re already in , the relative path would be
/home/ditiss.python/demos/demo01.py
Read Next
[Day 1] 6. User Interfacing
### **User Interfacing** In an operating system, there are two main types of interfaces through which users can interact with the system: 1. **G...
[Day 1] 7. Some Basic Commands
### **Shell Information** - `echo $SHELL`: Displays the default shell of your system. --- ### **Directory and File Listing** - `ls`: Displ...