0

I've been using the command below which works well for finding the largest files in a certain folder.

find . -printf '%s %p\n'| sort -nr | head -10

However this provides output in KB only.

20160 /home/user/userfile

How can I change this command to show me results in MB, or GB? I can do this with du and get similar results but I am looking for a way to do this by tweaking the command above.

dr_
  • 28,763
  • 21
  • 89
  • 133
user53029
  • 2,725
  • 8
  • 40
  • 65

1 Answers1

1
find . -type f -exec du -m {} \; | sort -nr | head -10

Execute a du for each regular file and give the desired option like -m for megabyte

Philippos
  • 13,237
  • 2
  • 37
  • 76