file sizes

All posts tagged file sizes by Linux Bash
  • Posted on

    When it happens that your VPS is eating data by the second and there is disk read/write issues one port of call you are bound to visit is searching and identifying large files on your system.

    Now, you would have been forgiven for thinking this is a complicated procedure considering some Linux Bash solutions for fairly simple things, but no. Linux Bash wins again!

    du -sh /path/to/folder/* | sort -rh

    Here, du is getting the sizes and sort is organising them, -h is telling du to display human-readable format.

    The output should be something like this:

    2.3T    /path/to/directory
    1.8T    /path/to/other
    

    It does take a while to organise as it is being done recursively however given 3-5mins and most scenarios will be fine.