Hacking101
  • Welcome
    • Roadmap
    • Linux 101
      • Getting Started
      • Linux File System
    • Networking 101
    • Python 101
    • Curiosity 101 (Searching)
  • Useful Tools
    • Gobuster
    • nmap
  • Linux
    • Linux
    • Useful Linux Commands
    • FTP
  • Windows
    • Windows
  • HackTheBox
    • Lame
    • Shocker
  • TryHackMe
    • Vulnversity
Powered by GitBook
On this page
  • Linux File Systems
  • Linux Directory Structure
  • Use of Directories

Was this helpful?

Edit on GitLab
  1. Welcome
  2. Linux 101

Linux File System

Linux File Systems, Logical Partitions, and Directory Structure

Linux File Systems

Linux supports many file systems ( EXT3, EXT4, XFS . . . ), the main purpose of the File Systems is providing methodology to Store files and folders in organised manner. File System decides many times they method files are stored, name_length and path_length limits, file_size limits among many other criteria. Many File Systems are specialised for specific purpose like Logging, long term archive, speed (performance) and more, where as some FileSystems are for General purpose use.

Linux Directory Structure

Linux Directory structure across various Linux distributions is similar, only slight variations which will be mentioned. Knowing about Linux File System and Directory structure is crucial because the target system has high chances of being a Linux machine and it helps if we know what directory holds some useful juicy information for us.

Directory
Description

/ (root filesystem)

root filesystem is the top-level directory of the filesystem. A symbolic link to most of the directories below are present in /(root) .

/bin

bin contains user executable files.

/boot

Static files of the boot loader

/dev

dev contains the 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 computer and facilitate access to those devices.

/etc

Host-specific system configuration

/home

Home directory storage for user files. Each user has a subdirectory in /home. (except root user)

/lib

Shared library files that are required to boot the system.

/media

A place to mount external removable media devices such as USB thumb drives that may be connected to the host.

/mnt

A temporary mount-point for regular filesystems (as in not removable media) that can be used while the administrator is repairing or working on a filesystem.

/opt

Additional programs and packages are located here.

/root

home directory for the root user.

/sbin

System binary files, executables used for system administration.

/tmp

Temporary directory is used by many programs and OS to store temporary files. Temporary files can be removed any time.

/usr

These are shareable, read-only files, including executable binaries and libraries, man files, and other types of documentation.

/var

Variable data files are stored here. This can include things like log files, MySQL, and other database files, web server data files, email inboxes, and much more.

Use of Directories

This can be a personal preference how we setup Linux , and can be as per organisational or application needs too. While setup of Linux Distributions we are offered to place all files in / (root) , that is single partition. Configurations can be :

  • 1-Single root partition holding everything under /(root) - most common one.

  • /(root) + EFI (System Partition) ( usually upto 500MB in SIze) - for EFI setups, where EFI partition is FAT32 formatted. I will not be mentioning EFI separately and consider is choosen accordingly.

  • /(root) + /home - where base installation and user files - /home is placed on different partitions as per need, in case setup goes wrong, /home files are still safe on different partition.

  • /(root) + /home + /var - when logging is the requirement or possibly the web-server files present in /var needs ample of space and rest is separated.

  • /opt can be given a separate partition if too many additional programs and packages are to be configured.

  • This is just informational and can be adjusted according to the needs.

References

PreviousGetting StartedNextNetworking 101

Last updated 1 year ago

Was this helpful?

Linux Directory Structure -

Linux Directory Structure -

https://www.pathname.com/fhs/
https://youtu.be/kSr9R8K66S8
https://youtu.be/42iQKuQodW4