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.
| Need | Use | Reason |
|---|---|---|
| Personal scripts for one user | ~/bin or ~/.local/bin | User-owned and easy to add to PATH |
| System-wide local script | /usr/local/bin | Reserved for local administrator-installed programs |
| Vendor application bundle | /opt/app-name | Keeps third-party app files together |
| Service persistent data | /var/lib/app-name | Standard place for daemon state |
| Service logs | journalctl or /var/log/app-name | Fits existing log tools |
| Website content | /srv/site-name or /var/www | Common service content locations |
| Temporary scratch data | /tmp | Short-lived and often automatically cleaned |
| Longer temporary data | /var/tmp | Temporary but more persistent across reboots on many systems |
| System config | /etc/app-name | Machine-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.