Filesystem, Paths, and FHS

Summary

This note explains how to think about the Linux filesystem, paths, and the basic idea of the filesystem hierarchy standard. The goal is to make file locations and system layout feel more logical.

Why this matters

  • many Linux tasks depend on knowing where files usually live
  • troubleshooting gets much easier when paths feel predictable
  • package, config, logs, and data all become easier to reason about with a filesystem model

Environment / Scope

ItemValue
Topicfilesystem hierarchy basics
Best use for this notebuilding Linux path awareness
Main focuscommon directories, config, logs, user space
Safe to practise?yes

Key concepts

  • Path - the location of a file or directory
  • Absolute path - full path from /
  • Relative path - path from the current working directory
  • FHS - a common model for where Linux system files tend to live

Mental model

Think about the filesystem like this:

AreaTypical role
/homeuser files and home directories
/etcsystem configuration
/varvariable data such as logs and state
/usrinstalled userland software and shared resources
/tmptemporary files

The exact distro details can vary, but the model is still very useful.

Everyday examples

SituationWhy this note helps
need to find a config file/etc becomes a strong first guess
need to review logs/var/log becomes easier to remember
need to understand app data locationpath role is easier to reason about
script fails because of wrong path assumptionabsolute vs relative path awareness helps

Common misunderstandings

MisunderstandingBetter explanation
”Linux file layout is random”it has a pattern even when distros differ in details
”Everything important lives in /homesystem config, logs, and software live elsewhere
”Relative path is good enough everywhere”automation and admin work often need clearer path handling
”If the file exists somewhere, the exact location does not matter”location often tells you the file’s role

Verification

CheckExpected result
Common directories feel recognisable/etc, /var, /home, and /usr have clear roles
Path choice is clearerfile location guesses improve
Troubleshooting feels fasterconfig and logs are easier to find
Script path handling improvesfewer wrong assumptions about current directory

Pitfalls / Troubleshooting

ProblemLikely causeWhat to check
Config file cannot be foundwrong path assumptionslikely config location
Script works only from one directoryweak path handlingrelative vs absolute path
Logs are hard to locateunclear understanding of variable data/var and app-specific log paths
File role is confusingpath context ignoredwhat directory it lives in

Key takeaways

  • Linux paths become much easier when you think in directory roles
  • config, logs, binaries, and user files usually live in different areas for a reason
  • path awareness is one of the fastest ways to improve Linux confidence

Official documentation