The Linux file system is a hierarchical tree structure that organizes all files and directories. Understanding this structure is crucial for navigation, system administration, and file management in Linux environments.
Key Concepts
- Root Directory (/): Top-level directory containing all others
- Mount Points: Where filesystems attach to directory tree
- Inodes: Data structures storing file metadata
- File Types: Regular files, directories, links, devices
- Permissions: Read, write, execute for user/group/other
- Path Types: Absolute (from /) vs relative (from current)
Command Syntax
ls [options] [path] - List directory contents
tree [options] [path] - Display directory tree
file [options] filename - Identify file type
stat filename - Show detailed file information
Common Options
-l - Long format with permissions/ownership
-a - Show hidden files (starting with .)
-h - Human readable file sizes
-R - Recursive listing
-i - Show inode numbers
Practical Examples
Example 1: Standard Directory Structure
|
|
Example 2: View file details
|
|
Shows permissions, ownership, size, and timestamp
Example 3: Check file type
|
|
Identifies executable binary file
Example 4: Directory tree view
|
|
Use Cases
- System administration and maintenance
- Software installation and configuration
- User data organization
- Security and permission management
- Backup and recovery operations
- Troubleshooting system issues
Related Commands
pwd - Print working directory
cd - Change directory
mkdir - Create directories
rmdir - Remove empty directories
find - Search for files and directories
locate - Find files using database
which - Locate command binaries
whereis - Locate binaries, source, manuals
Tips & Troubleshooting
- Use
df -hto check filesystem usage - Hidden files start with dot (.)
/procand/sysare virtual filesystems- Always use absolute paths in scripts
- Be careful with case sensitivity
- Use
lsofto see open files - Check mount points with
mountcommand - Avoid storing data in
/tmppermanently - Use
du -shto check directory sizes - Remember
/is filesystem root, not user root