Common Directories of Linux
An organized beginner-friendly note on key Linux root directories and why /etc, /var, /root, and /tmp matter.
When you start working seriously on Linux, understanding the directory structure makes everything easier.
This note covers four very common and important directories:
/etc/var/root/tmp
/etc
The /etc directory is one of the most important locations in Linux. The name comes from “etcetera,” and it mainly stores system-wide configuration files used by the operating system and services.
A few important files and folders you will often see:
/etc/sudoersand/etc/sudoers.d/: Define which users and groups can run commands withsudoprivileges./etc/passwd: Stores user account information (usernames, UIDs, home directories, login shells)./etc/shadow: Stores password hashes and password policy data. This file is protected and typically readable only by root.
Example:
1
2
ls /etc
# shadow passwd sudoers sudoers.d
/var
The /var directory (short for “variable”) stores data that changes frequently while the system is running.
This includes:
- Logs from system and services (for example,
/var/log) - Cache and spool data
- Application and service data such as databases
- Temporary data generated by background services
Example:
1
2
ls /var
# backups log opt tmp
If you are troubleshooting a Linux server, /var/log is usually one of the first places to check.
/root
The /root directory is the home directory of the root user (the administrative superuser).
This is different from /home, where regular users have their own home folders.
So even though it may look like root should live in /home/root, Linux uses /root by default.
Example:
1
2
ls /root
# myfile myfolder passwords.xlsx
Only privileged users should access this directory.
/tmp
The /tmp directory is used for temporary files.
Important properties:
- Data here is meant to be short-lived.
- Many systems clear
/tmpon reboot. - By default, all users can write to it.
Example:
1
2
ls /tmp
# todelete trash.txt rubbish.bin
From a pentesting perspective, /tmp is useful for dropping short-term scripts and tools after gaining access, because it is writable and intended for temporary data.
Quick Summary
/etc: System configuration files./var: Frequently changing service and system data (especially logs)./root: Home directory of the root user./tmp: Temporary, writable storage for short-lived data.
Learning these directories early gives you a strong foundation for Linux administration, troubleshooting, and security work.