Filesystem practice

Filesystem practice

What Folder Should I Use?

A practical decision guide for placing scripts, apps, service data, logs, temporary files, and shared resources on Linux.

Audience
Users organizing real systems
Reading time
10 min

Choose by purpose

Linux directory choices are easier when you separate personal files from system files, and configuration from data. The goal is not perfection; it is predictability for you, tools, backups, and future maintainers.

Choose by purpose
NeedUseReason
Personal scripts for one user~/bin or ~/.local/binUser-owned and easy to add to PATH
System-wide local script/usr/local/binReserved for local administrator-installed programs
Vendor application bundle/opt/app-nameKeeps third-party app files together
Service persistent data/var/lib/app-nameStandard place for daemon state
Service logsjournalctl or /var/log/app-nameFits existing log tools
Website content/srv/site-name or /var/wwwCommon service content locations
Temporary scratch data/tmpShort-lived and often automatically cleaned
Longer temporary data/var/tmpTemporary but more persistent across reboots on many systems
System config/etc/app-nameMachine-wide configuration

Rules of thumb

  • If only one user needs it, keep it in that user's home directory.
  • If the package manager owns it, do not hand-edit it unless documentation says so.
  • If a daemon writes it over time, expect it under /var.
  • If it is configuration for the whole machine, expect it under /etc.
  • If it is a removable or temporary mount, use /media or /mnt depending on context.