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
  • 57,621
  • 49
  • 238
  • 373
Kiran K Telukunta
  • 2,178
  • 3
  • 20
  • 19

2 Answers2

12

Specify -type f for file:

find -type f -printf '%s %p\n' |sort -nr | head
Tomas
  • 57,621
  • 49
  • 238
  • 373
wmorrison365
  • 5,995
  • 2
  • 27
  • 40
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,661
  • 11
  • 15