Chapter 9. Managing Files and Partitions

Introduction

Understanding filesystem fundamentals is key to understanding how Linux works. Everything is a file—data files, partitions, pipes, sockets, and hardware devices. Directories are simply files that list other files.

The Filesystem Hierarchy Standard (FHS) was developed as a voluntary standard. Most Linuxes follow it. These are the required elements of the Linux root filesystem:

/

Root directory, even though it is always represented at the top

/bin

Essential system commands

/boot

Static boot loader files

/dev

Device files

/etc

Host-specific system configuration files

/lib

Shared libraries needed to run the local system

/mnt

Temporary mount points

/opt

Add-on software packages (not used much in Linux)

/proc

Live kernel snapshot and configuration

/sbin

System administration commands

/tmp

Temporary files—a well-behaved system flushes them between startups

/usr

Shareable, read-only data and binaries

/var

Variably sized files, such as mail spools and logs

These are considered optional because they can be located anywhere on a network, whereas the required directories must be present to run the machine:

/home

User’s personal files

/root

Superuser’s personal files

The FHS goes into great detail on each directory, for those who are interested. Here are some things for the Linux user to keep in mind:

  • /tmp and /var can go in their own individual partitions, as a security measure. If something goes awry and causes them to fill up uncontrollably, they will be isolated from ...

Get Linux Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.