How to Check Disk Space on Raspberry Pi Quickly
To check disk space on a Raspberry Pi, open the terminal and use the
df -h command to see available and used space in a human-readable format. For detailed folder sizes, use du -sh /path/to/folder.Syntax
The main command to check disk space is df. Use -h to show sizes in a human-friendly way (like MB or GB). For folder sizes, du is used with -s for summary and -h for human-readable output.
df -h: Shows disk usage of all mounted filesystems.du -sh /path/to/folder: Shows total size of a specific folder.
bash
df -h du -sh /path/to/folder
Example
This example shows how to check the disk space on your Raspberry Pi's root filesystem and the size of the home directory.
bash
df -h / du -sh /home/pi
Output
Filesystem Size Used Avail Use% Mounted on
/dev/root 15G 4.5G 9.7G 32% /
1.2G /home/pi
Common Pitfalls
One common mistake is running df without the -h option, which shows sizes in bytes and is hard to read. Another is forgetting to specify the folder path with du, which then shows sizes for all subfolders and can be overwhelming.
Also, running these commands without proper permissions might not show all data.
bash
df du -sh # Correct usage: df -h du -sh /home/pi
Quick Reference
| Command | Description |
|---|---|
| df -h | Show disk space usage of all mounted filesystems in human-readable format |
| df -h / | Show disk space usage of root filesystem |
| du -sh /path/to/folder | Show total size of a specific folder in human-readable format |
| df -i | Show inode usage (number of files) |
| lsblk | List block devices and their mount points |
Key Takeaways
Use
df -h to quickly see disk space in a readable format.Use
du -sh /folder to check the size of specific folders.Always include
-h for human-readable output.Check permissions if disk space info seems incomplete.
Use
lsblk to view storage devices and mount points.