Find Largest Directories/Files when Drive is Full [duplicate]

Solution 1:

If you can ssh from a different machine, then you can pipe the output to sort on the machine that is not full. Let's say that you have two machines -- slim (which doesn't have a full hard drive) and full, which does.

From the command prompt on slim:

ssh user@full 'du -sh /' | sort -h

The first part:

ssh user@full 'du -sh /'

generates output from full. The pipeline | sort -h is running locally on slim, so you won't get errors about disk space.