4

Wit the following command I can find largest directory.

find <directory> -printf '%s %p\n' |sort -nr | head

But is there a way to find largest file within all the subdirectories in directory ?

Tomas
  • 54,903
  • 47
  • 225
  • 361
Kiran K Telukunta
  • 1,958
  • 2
  • 20
  • 19

2 Answers2

12

Specify -type f for file:

find -type f -printf '%s %p\n' |sort -nr | head
Tomas
  • 54,903
  • 47
  • 225
  • 361
wmorrison365
  • 5,585
  • 2
  • 26
  • 39
0

With the command you just gave, you get the largest file. If you want to summarize the size for each file recursively for directories you may want to use the `du' command.

quicoju
  • 1,571
  • 10
  • 15