My *nix world

Disk usage in bash

I run several headless systems and sometimes I need to know the disk usage of a particular directory. We have several choices, from the ls command to the ncurses ncdu utility.

For what I need 'ls' does not provide support out of the box. The ncdu looks more alike but I don't need ncurses dependencies or other tools added to my toolbox. I need a 10 line bash script, eventually written by myself 🙂 (let's reinvent the wheel, don't we?)

My solution

Create a bash script called "du1" (or whatever you like). So this is how you get disk usage in bash:

The result

That's why I think Linux can be fun!

Now, if you think that this article was interesting don't forget to rate it. It shows me that you care and thus I will continue write about these things.

 
The following two tabs change content below.
Disk usage in bash

Eugen Mihailescu

Founder/programmer/one-man-show at Cubique Software
Always looking to learn more about *nix world, about the fundamental concepts of math, physics, electronics. I am also passionate about programming, database and systems administration. 16+ yrs experience in software development, designing enterprise systems, IT support and troubleshooting.
Tagged on: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers: