PLATFORM
  • Tails

    Create websites with TailwindCSS

  • Wave

    Start building the next great SAAS

  • Pines

    Alpine & Tailwind UI Library

  • Auth

    Plug'n Play Authentication for Laravel

  • Designer comingsoon

    Create website designs with AI

  • DevBlog comingsoon

    Blog platform for developers

  • Static

    Build a simple static website

  • SaaS Adventure

    21-day program to build a SAAS

Show Folder sizes in terminal on your Mac

du -sh *

No matter how much space I have on my hard drive I seem to run out of space all the time. I constantly find myself in need of listing out all the files in a directory with all their file sizes. This way I can delete some of the larger files and folders that I no longer need.

To list out file/folder sizes for a specific directory in terminal you can use the du command, which stands for Disk Usage; however, you will also want to include a few flags in this command as well:

du -sh *

This will output the current directory files and folders into Human Readable text.

Now, it might also come in handy to list the files and folders out from largest to smallest:

du -sh * | sort -rn

Here's a quick Alias command you can add to make your life easier:

alias diskusage="du -sh * | sort -rn"

Now, all you need to do is type the following in terminal:

diskusage

And you will get a list of all the files and folders in that directory from largest filesize to smallest.

BETA Snippet explanation automatically generated by OpenAI:

No explanation generated yet.

Snippet By Dev Dojo

ยท

Created June 12th, 2021

ยท

Report Snippet