k1lgor
Posted on March 9, 2023
Introduction
The df
command is a useful tool for managing disk space on your Linux system. It displays information about the file system disk space usage, including the amount of free space, used space, and the percentage of space used. Here are some examples of using df
command:
Show disk space usage in human-readable format
df -h
Show disk space usage for a specific file system
df -hT /dev/sda1
Show disk space usage for all file systems (including speudo file systems)
df -aTh
Show disk space usage for a specific file system and exclude file systems of a certain type
df -hT -x tmpfs /dev/sda1
Show disk space usage in bytes for all file systems (including empty file systems)
df -BT
Show disk space usage for a specific file system with inode information
df -i /dev/sda1
Show disk space usage with a specific output format
df --output=source,fstype,size,used,avail,pcent,target
Show disk space usage sorted by a specific column (ascending)
df -hT | sort -k 3
Show disk space usage sorted by a specific column (descending)
df -hT | sort -k 3 -r
Show disk space usage for all file systems and exclude the header line
df -hT | tail -n +2
Tips
- Use the
h
option to display disk space usage in human-readable format (e.g., GB, MB) - Use the
x
option to exclude file systems of a certain type (e.g., tmpfs,devtmpfs) - Use the
-output
option to customize the output format of the command - Use the
sort
andtail
commands to sort and filter the output as needed.
Conclusion
In summary, the df
command is a powerful tool for managing disk space on your Linux system. With the various options available, you can easily view and analyze disk space usage for specific file systems and customize the output format.
Remember to use the available sorting and filtering commands to further manage and analyze the output.
Thank you for reading 🧑💻
Stay tuned for more 🚀
✌️ and logout
Posted on March 9, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.