Ubuntu df/du Commands: Checking Disk Space Usage
In the Linux system, `df` and `du` are core tools for disk space management, used to view overall partition usage and specific directory/file space respectively. `df` (Disk Free) analyzes partition-level usage: The basic command is `df -h` (human-readable units). Key parameters include `-T` (display file system type) and `-i` (check inode usage). Output columns include partition device (e.g., `/dev/sda2`), total capacity, used/available space, usage percentage, and mount point (e.g., `/`). Note that `tmpfs` is a memory-based virtual partition and can be ignored. `du` (Disk Usage) focuses on directory/file details: Common commands are `du -sh` (quickly sum directory sizes), `du -ah` (include hidden files), and `du --max-depth=1` (only first-level subdirectories). Examples include `du -sh /home` to check total directory usage, and `du -ah /tmp | sort -hr | head -n 10` to identify large files. **Key Differences**: `df` checks overall partition usage (e.g., clean if root partition exceeds 85% usage), while `du` inspects specific content (
Read More