Essential Commands for Assessing Storage Conditions:
Below are fundamental commands providing insight into storage devices and their current usage conditions.
-
To list available drives in the system along with their mounting directories, use
# lsblk
-
To view the current disk usage by the filesystem, including total size, used space, percentage of usage, and mounted directory for each drive, execute:
# df -h
-
To determine the size of a specific directory , utilize:
# du -sh /home
Advanced Commands for Evaluating Storage Conditions:
Disk Usage Summary: Sometimes, it's helpful to get an overall summary of disk usage across the entire system.
- You can use a combination of commands like du, sort, and head to achieve this:
# sudo du -ah / | sort -rh | head -n 20
Ex: sudo du -ah cloudmail/2024-02-06/accounts/ | sort -rh | head -n 20
- Disk Usage with File Types: If you want to analyze disk usage by file types, you can use commands like find along with du
# sudo find /path/to/directory -type f -exec du -h {} + | sort -rh | head -n 20