Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Linux command to find the size of largest file in a directory

846213Nov 2 2014 — edited Dec 29 2014

Hi,

I have a requirement to find the size of largest file in a directory on Linux. The current command I have uses LS, which is slow when comes to large systems with many files (e.g.g media files, text files).

find /home/directory -printf '%s %p\n'|sort -nr|head | head -1 | awk '{print $1}'

Is there another command which is faster?
Thank you.

Regards,

Joseph

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jan 26 2015
Added on Nov 2 2014
5 comments
2,774 views