Figuring out the size of folders in your Terminal

Ever wonder how big those folders are getting on your server? Your wp-uploads folders can get huge over time, and it's hard to figure out just how huge.

Using ls -la tells you about the files, but not the folders.

Luckily we've got something better. Give du -hsc * a try. It will return a pile of useful.

I can now see the size of each file and folder in my current directory and I get a total at the end. Cool! The odds of you actually remembering that command in two weeks time though is probably zero, so let's setup an alias with a better name:

  1. Log in to your server
  2. Type nano ~/.bash_profile
  3. Nano is a basic text editor. In that window add a new line: alias whatsize="du -hsc *"
  4. Save and close that file (ctrl+x)
  5. When Nano closes and you get back to the $ prompt, you'll need to tell your shell about the new alias you just created. Do that with: source ~/.bash_profile.
  6. Last, go to a folder you want to inspect and simply type whatsize!
Follow along →@saltcod