0

With this code I can find largest files in /usr directory which includes directories as well

du -a /usr | sort -n | tail -n 2

But I want only files not directories what can I do?

1 Answer 1

0

A find command can do this as:

find <folder> -type f -printf '%s %p\n'| sort -nr

Unless the du command, this will print the byte size of the file, not the space it actually takes up on disk. That, however, fits the goal expressed in your question of "finding largest file", so it may be the better tool for your job.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .