Question: I’m trying to find out the total size of my hard drive using df -h, but it prints the size of each partition and requires sudo.

Is there any way to get total size of my hard drive using the command line, without requiring root permission?

Answer: A hacky way is to bypass the need for sudo by reading out the system log with:

dmesg | grep blocks

Please note that this might not be ideal, so your mileage may vary…

💠

🔵 Best-selling data storage everyone's buying.

Fast, reliable, and on sale now. Thousands pick these weekly — don't miss Amazon's lowest storage prices.

Top 10 Bestsellers
🏆 4.7★+ Reviews
📦 Prime Shipping
👉 See today's best-selling hard drives, USB flash drives & SSDs on Amazon.com HDD · USB Flash Drives · SSD · External Drives
🛒
✅ Updated hourly — Amazon real-time ranking 🔥 Limited stock deals 🔗 Affiliate
⭐ Click to see complete best-selling list ⭐