0

I would like to create an script where give me a report of which folders have the higher usage space and keep doing that until there's no folder anymore.

Today I do this manually, with:

sudo du -h --max-depth=1 | sort -n -r

And I see which folder are the higher and enter on it and go on. But I would like to this automatically.

Any idea ?

Valter Silva
  • 1,371
  • 7
  • 23
  • 32
  • Let me know if your requirements are so specific that the linked question doesn't work for you. Then I'll reopen yours. – Daniel Beck Apr 19 '13 at 13:37
  • Hi Daniel, it's not the same thing, I would like to build a script that loop through the largest folders, every showned in the post that you link as duplicated keeps given me: ` [valter@vm28 /]$ sudo find . -type f -exec ls -s {} \; | sort -n -r find: ./proc/7942/task/7942/fdinfo/4: No such file or directory find: ./proc/7942/fdinfo/4: No such file or directory ` – Valter Silva Apr 19 '13 at 14:17
  • This post was very useful for me: http://superuser.com/questions/300606/how-to-analyse-disk-usage-in-command-line-linux I install ncdu, it's not what I intend but since my post is blocked =]. I want to generated a report, not have to install ncdu in every machine.. – Valter Silva Apr 19 '13 at 14:37
  • 1
    `tdu` (linked from ncdu web page) parses `du` output. So just run `du` on every machine, analyze on any other. Also, feel free to add an answer to the linked question if you feel you can add relevant information not already present in any of the other 12 answers. – Daniel Beck Apr 19 '13 at 14:40

0 Answers0