Skip to content

Instantly share code, notes, and snippets.

@kunato
Forked from joostvanveen/du.sh
Created March 16, 2023 05:44
Show Gist options
  • Select an option

  • Save kunato/0380c6769aeb6addfca7b3f362eeaed4 to your computer and use it in GitHub Desktop.

Select an option

Save kunato/0380c6769aeb6addfca7b3f362eeaed4 to your computer and use it in GitHub Desktop.

Revisions

  1. Joost van Veen revised this gist May 1, 2019. 1 changed file with 5 additions and 5 deletions.
    10 changes: 5 additions & 5 deletions du.sh
    Original file line number Diff line number Diff line change
    @@ -2,16 +2,16 @@
    df -h

    # Get the top 10 biggest folders in the current directory
    du -h --max-depth=1 | sort -rn | head -10
    du -h --max-depth=1 | sort -rh | head -10

    # Get the top 10 biggest folders in the current directory and their first child directories
    du -h --max-depth=2 | sort -rn | head -10
    du -h --max-depth=2 | sort -rh | head -10

    # Get sizes of all folders in the current directory
    du -h --max-depth=2 | sort -rn
    du -h --max-depth=2 | sort -rh

    # On Mac OSX max depth 1
    du -hd1 | sort -rn | head -10
    du -hd1 | sort -rh | head -10

    # On Mac OSX max depth 2
    du -hd2 | sort -rn | head -10
    du -hd2 | sort -rh | head -10
  2. Joost van Veen revised this gist Oct 30, 2018. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions du.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,6 @@
    # Get available disk space
    df -h

    # Get the top 10 biggest folders in the current directory
    du -h --max-depth=1 | sort -rn | head -10

  3. Joost van Veen revised this gist Sep 24, 2018. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion du.sh
    Original file line number Diff line number Diff line change
    @@ -5,4 +5,10 @@ du -h --max-depth=1 | sort -rn | head -10
    du -h --max-depth=2 | sort -rn | head -10

    # Get sizes of all folders in the current directory
    du -h --max-depth=2 | sort -rn
    du -h --max-depth=2 | sort -rn

    # On Mac OSX max depth 1
    du -hd1 | sort -rn | head -10

    # On Mac OSX max depth 2
    du -hd2 | sort -rn | head -10
  4. Joost van Veen revised this gist Sep 18, 2018. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion du.sh
    Original file line number Diff line number Diff line change
    @@ -1 +1,8 @@
    du --max-depth=1 | sort -nr | cut -f2- | xargs du -hs
    # Get the top 10 biggest folders in the current directory
    du -h --max-depth=1 | sort -rn | head -10

    # Get the top 10 biggest folders in the current directory and their first child directories
    du -h --max-depth=2 | sort -rn | head -10

    # Get sizes of all folders in the current directory
    du -h --max-depth=2 | sort -rn
  5. Joost van Veen revised this gist Aug 2, 2016. No changes.
  6. Joost van Veen created this gist Aug 2, 2016.
    1 change: 1 addition & 0 deletions du.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    du --max-depth=1 | sort -nr | cut -f2- | xargs du -hs