After decades of Unix evolution, some directory names remain cryptic to modern users. Let's decode their origins:
- /etc: Originally from "et cetera" (Latin for "and others"). In early Unix versions, this contained miscellaneous system configuration files that didn't fit elsewhere.
- /var: Short for "variable" - stores files expected to change size during normal operation (logs, spools, temp files)
- /opt: From "optional" - designed for add-on application software packages
- /bin vs /sbin: "Binary" vs "System binary" (the latter contains essential system administration commands)
While the Filesystem Hierarchy Standard (FHS) defines these conventions, real-world usage often requires interpretation:
# Example of proper directory usage in a script:
#!/bin/bash
CONFIG_FILE="/etc/myapp.conf"
LOG_DIR="/var/log/myapp"
INSTALL_DIR="/opt/myapp/bin"
Follow this logic when installing new software:
- System-wide utilities: /usr/local/bin (for locally compiled software)
- Self-contained packages: /opt (ideal for proprietary/commercial software)
- System-critical binaries: /usr/bin or /usr/sbin
- User-space programs: ~/.local/bin (for single-user installations)
Frequently observed anti-patterns and their solutions:
# Bad practice - mixing config locations
cp config.txt /etc/myapp/
cp other_config.txt /usr/local/etc/myapp/
# Correct approach - consolidate under /etc
mkdir /etc/myapp
mv /usr/local/etc/myapp/* /etc/myapp/
rmdir /usr/local/etc/myapp
For specialized systems, you might need to modify the standard hierarchy:
# Example of mounting dedicated partitions
/dev/sdb1 /bigdata ext4 defaults 0 2
/dev/sdc1 /fastlogs xfs defaults,noatime 0 2
# Symbolic link alternatives
ln -s /bigdata/mysql /var/lib/mysql
ln -s /fastlogs/apache /var/log/apache2
Remember that while the FHS provides guidelines, specific distributions may implement slight variations. Always check your distribution's documentation for local conventions.
Understanding Unix directory names requires looking back at early Unix development at Bell Labs in the 1970s. Many directory names are abbreviations that made sense to the original developers:
/etc
: Originally stood for "et cetera" - the catch-all directory for configuration files/var
: Short for "variable" - stores files that change frequently/opt
: From "optional" - for add-on application software packages/bin
: Binary executables/usr
: User utilities and applications (originally user home directories)
While the original meanings persist, modern Linux distributions follow the Filesystem Hierarchy Standard (FHS). Here's where different types of software should be installed:
# System critical binaries (available in single-user mode)
/bin
/sbin
# User binaries (most commands you use daily)
/usr/bin
/usr/sbin
# Third-party software
/opt/company_name/application_name
# Locally compiled software
/usr/local/bin
/usr/local/sbin
The proper location depends on the scope of the configuration:
# System-wide configs
/etc/application.conf
# User-specific configs
~/.config/application/
~/.applicationrc
# Temporary runtime configs
/run/application/
Use /var
for persistent variable data and /tmp
for temporary files:
# Good for logs, databases, mail spools
/var/log/
/var/lib/mysql/
/var/mail/
# Temporary files (cleared on reboot)
/tmp/download_cache/
Most distributions handle this automatically, but when installing manually:
# Distro packages use
/usr/bin/application
# Locally compiled software uses
/usr/local/bin/application
# Self-contained third-party apps use
/opt/application/bin/
These virtual filesystems provide kernel and process information:
# View system memory info
cat /proc/meminfo
# Check CPU information
cat /proc/cpuinfo
# Interact with kernel parameters
echo 1 > /sys/module/module_name/parameters/parameter