
Linux File System
Think of the Linux file system like a well-organized library. Just as a library has different sections for books, magazines, and reference materials, Linux organizes its files in a structured way. Unlike Windows which uses drive letters (C:, D:, etc.), Linux starts everything from a single root directory, represented by a forward slash (/
).
Basic Structure of the Linux File System
Let's explore the main directories you'll encounter, using our library analogy:
Directory | Purpose | Library Analogy |
---|---|---|
/ (Root) |
The starting point of the file system | The library's main entrance |
/bin |
Essential programs everyone needs | Basic library tools (scanners, computers) |
/sbin |
System administration programs | Library staff tools and equipment |
/etc |
Configuration files | Library rules and policies |
/dev |
Device files (hardware) | Library equipment connections |
/proc |
System process information | Library activity logs |
/var |
Files that change frequently | Check-out records and logs |
/tmp |
Temporary files | Scratch paper and temporary notes |
/usr |
User programs and data | Main collection of books and resources |
/home |
Personal directories for each user | Individual study rooms |
/boot |
Boot loader files | Library opening procedures |
/lib |
System libraries | Reference materials and guides |
Your Personal Space: The Home Directory
As a student, you'll spend most of your time in your home directory. It's like having your own study room in the library. Here's a typical structure you might create:
/home/cis120/c120001/
├── assignments/ # Class assignments
├── labs/ # Lab exercises
├── documents/ # Class notes and assignments
├── downloads/ # Files you've downloaded
└── pictures/ # Your photos and images
Basic Navigation
Let's practice some basic navigation using commands (we will learn more about these commands later)
# See where you are
pwd
# Go to your home directory
cd ~
# View the structure of your current directory
tree -L 2
Common Operations
Here are some everyday tasks you'll perform:
- Finding Your Location: Use
pwd
to see where you are - Moving Around: Use
cd
to change directories - Viewing Contents: Use
tree
to see the structure
Best Practices
To keep your files organized and easy to find:
- Use simple, descriptive names for directories
- Keep related files together in the same directory
- Avoid spaces in directory and filenames (use underscores instead)
- Create a logical structure that makes sense to you
- Regularly clean up older unused files
Common Mistakes to Avoid
- Getting lost in deep directory structures
- Not knowing your current location
- Using inconsistent naming conventions
- Forgetting that Linux is case-sensitive
- Not organizing files from the start
Now that you have a basic understanding of the Linux file system, let's move on to the next section where we'll learn how to navigate and manage files using commands.