Linux Directory Basics
Understanding Linux Filesystem Structure
Linux filesystem provides a hierarchical organization for storing and managing files and directories. The root directory (/) serves as the primary entry point, with various subdirectories serving specific purposes.
graph TD
A[Root Directory /] --> B[bin]
A --> C[etc]
A --> D[home]
A --> E[var]
A --> F[usr]
Key Directory Types
Directory |
Purpose |
Typical Contents |
/bin |
Essential user binaries |
System commands |
/etc |
System configuration |
Configuration files |
/home |
User home directories |
Personal files |
/var |
Variable data |
Logs, temporary files |
/usr |
User programs |
Additional software |
Basic Directory Navigation Commands
Linux provides powerful commands to explore and manage directory structures:
## List directory contents
ls /
## Show current directory
pwd
## Change directory
cd /home/username
## Create new directory
mkdir new_directory
## Remove directory
rmdir empty_directory
The ls
command reveals filesystem details, showing files and subdirectories within each location. The -l
flag provides detailed information about permissions, size, and modification dates.
Mastering directory basics enables efficient file organization and system navigation in Linux environments.