Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to search for files with a certain filename and size in linux?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

With the following command you can search for files with .log and size over 100k in the actual directory.

find ./ -type f -size +100k -name "*.log"
share|improve this answer
3  
Wrap the argument to -name in quotes to avoid it being expanded by the shell if a file matching the wildcard exists in the current directory. Also, find searches according to the criteria in the order they are given, and the name lookup is the fastest, so make it a habit to put the -name directive before -type and other directives that requires stat calling on files. See the second example given in the GNU find manual for a reference. –  Daniel Andersson Aug 2 '12 at 10:26
    
Thx for the comment, i wrap the argument in quotes. –  kockiren Aug 2 '12 at 10:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.