The Linux filesystem is the directory structure used to organize files, folders, programs, system settings, logs, devices, and user data.
In Linux, everything starts from the root directory:
/Simple recall:
/ is the starting point of the Linux filesystem.
The root directory is the top-level directory in Linux.
Every file and folder exists under /.
Example:
/
├── home
├── etc
├── var
├── usr
├── bin
├── sbin
├── tmp
├── dev
├── procSimple recall:
Root / is the parent of all directories.
| Directory | Purpose |
|---|---|
/ |
Root directory |
/home |
User personal directories |
/root |
Home directory of root user |
/etc |
Configuration files |
/var |
Variable data like logs |
/usr |
User programs and system resources |
/bin |
Essential user commands |
/sbin |
System administration commands |
/tmp |
Temporary files |
/dev |
Device files |
/proc |
Process and kernel information |
/opt |
Optional third-party software |
/mnt |
Temporary mount point |
/media |
External devices like USB drives |
The /home directory contains normal user files.
Example:
/home/demoIf the username is demo, the user's home directory is:
/home/demoSimple recall:
/home stores user data.
The /root directory is the home directory of the root user.
It is different from /.
Important:
/means root directory/rootmeans root user's home directory
Simple recall:
/ = top of filesystem
/root = root user's personal folder
The /etc directory stores system configuration files.
Examples:
/etc/passwd
/etc/hostname
/etc/fstabSimple recall:
/etc contains settings.
The /var directory stores changing data.
It commonly contains:
- Logs
- Cache
- Spool files
Example:
/var/logSimple recall:
/var contains variable data.
The /usr directory stores user programs, libraries, documentation, and shared system resources.
Example:
/usr/bin
/usr/lib
/usr/shareSimple recall:
/usr contains many installed programs and resources.
The /bin directory contains essential commands used by normal users.
Examples:
/bin/ls
/bin/cp
/bin/mvSimple recall:
/bin contains basic commands.
The /sbin directory contains system administration commands.
Examples:
/sbin/reboot
/sbin/shutdownSimple recall:
sbin means system binaries.
The /tmp directory stores temporary files.
Files in /tmp may be deleted automatically.
Simple recall:
/tmp is for temporary storage.
The /dev directory contains device files.
Examples:
/dev/sda
/dev/null
/dev/ttySimple recall:
Linux treats devices like files.
The /proc directory contains information about running processes and the kernel.
Example:
/proc/cpuinfo
/proc/meminfoSimple recall:
/proc gives live system information.
The /opt directory is used for optional third-party software.
Simple recall:
/opt means optional software.
/mnt is used for temporarily mounted filesystems.
/media is commonly used for removable devices like USB drives.
Simple recall:
/mnt= manual mount location/media= removable device location
An absolute path starts from /.
Example:
/home/demo/Documents/file.txtSimple recall:
Absolute path starts from root.
A relative path starts from the current directory.
Example:
Documents/file.txtSimple recall:
Relative path depends on where you are now.
The ~ symbol represents the current user's home directory.
Example:
cd ~If the user is demo, then ~ means:
/home/demoSimple recall:
~ means my home directory.
| Symbol | Meaning |
|---|---|
. |
Current directory |
.. |
Parent directory |
Example:
cd .
cd ..Simple recall:
. = here
.. = one level back
Shows current location.
pwdLists root directory.
ls /Lists home directories.
ls /homeMoves to root directory.
cd /Moves to current user's home directory.
cd ~Moves one directory back.
cd ..Create a practice directory:
mkdir LinuxPracticeEnter the directory:
cd LinuxPracticeCreate folders:
mkdir Docs Images BackupCheck the folders:
lsExpected output:
Backup Docs ImagesCheck current location:
pwdExample output:
/home/demo/LinuxPractice/is the root directory./homestores normal user files./rootis the root user's home folder./etcstores configuration files./varstores logs and changing data./binstores essential user commands./sbinstores system administration commands./tmpstores temporary files./devstores device files./procstores live system and process information.- Absolute path starts from
/. - Relative path starts from the current directory.
~means current user's home directory..means current directory...means parent directory.
The root directory / is the top-level directory in Linux. All files and folders exist under it.
/ is the root directory of the whole filesystem.
/root is the home directory of the root user.
The /home directory stores normal users' personal files and folders.
The /etc directory stores system configuration files.
The /var/log directory stores system and application log files.
An absolute path starts from the root directory /.
Example:
/home/demo/Documents/file.txtA relative path starts from the current working directory.
Example:
Documents/file.txt~ represents the current user's home directory.
.. means the parent directory.
Because troubleshooting Linux systems requires knowing where user files, configuration files, logs, commands, and system information are stored.