Linux Disk Space Made Human-Readable with df -h

Ever looked at disk usage in Linux and thought… “what am I even reading?” 😅 I was working with the `df` command while monitoring disk space 💻   And initially ran: df The output?   Huge numbers. Thousands. Millions. Hard to interpret quickly ❌ Then I used: df -h And suddenly everything made sense ✅ So what exactly does `-h` do? It makes the output human-readable. But what does “human-readable” really mean here? 🤔 It means converting raw numbers into units we naturally understand. Without `-h`, disk space is shown in kilobytes: 52428800   31457280  Technically correct ✔️   Practically confusing ❌ Because as humans, we don’t think in KB.   We think in MB, GB, TB. With `-h`, the same data becomes: 50G   30G  Now your brain instantly understands it ⚡ That’s the real power of `-h`: Not changing the data   But changing how easily you can interpret it Lesson for developers 🚀 Good tools don’t just give correct output   They give understandable output Whether you are writing scripts, building APIs, or designing systems: Clarity > Raw Data Because fast understanding leads to faster decisions ⚡ Sometimes, improving readability is more impactful than improving logic. What’s one small flag or feature that made your life easier while coding? 👇 #SoftwareEngineering #Programming #Linux #DevTips #Coding #Debugging #Scripting #LearnToCode #TechCareers #Developers #ProgrammingTips #buildinpublic

  • Infographic explaining the -h flag in the Linux df command, comparing raw disk usage shown in large kilobyte values without -h versus simplified gigabyte values with -h. Highlights how human-readable output makes disk space easier to understand by converting complex numbers into familiar units like GB.

Nothing confusing about it. If it was just a number and you had no unit maybe. But if you know you're looking at KB.. then maybe it's a you problem.

KB is at least a real unit. G could mean either Gigabit, Gibibit, Gigabyte or Gibibyte.

"df -BG" is more useful in the long run, -h is handy on a desktop box and feels a bit more like "oooh, thanks, helpful computer" maybe it's still useful on a very minimal cloud server, but, some machines have 600 disks attached, maybe via a SAN/NAS affair, and on them, maybe 1800 mount points, and then you've got to consider union or nullfs mounts these days too, so duplicates as well. In the end "df -BT" for show everything in Terabytes was my goto even ten years ago because anything smaller than 1TB was not relevant at all. -h just gets in the way and makes it hard to scan the list by eye with a lot of filesystems.

From df the natural progression is to du -sh * | sort -h. My daughter just told me last night that the usb drive was full. du -sh * reports missing 10 GB. Apparently all hidden in .Trash. So now I am switching to du -hd 1 | sort -h

Like
Reply

Also 'sudo du -h . | sort -h' is a good one for finding the biggest culprits to delete.

Like
Reply

I wander which ai provides this stupid posts since linked in is full of them 😆😂🤣

No I haven't.  man pages exist

See more comments

To view or add a comment, sign in

Explore content categories