How to identify and locate large files and folders

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.


Related posts

Published by

Linux Bash

Linux Bash

Providing immersive and explanatory content in a simple way anybody can understand.