Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have twenty directories and im looking for a file with a known length somewhere in one of the directories.

Is there a Linux command to search a directory for a file by size?

What is the best method to locate this file?

share|improve this question
up vote 0 down vote accepted

The standard command to find files is find:-

find {directory} -size {byte count}c

If the directories are in disparate places, you can either use a for command to search each of the directories in turn, or create a specific directory with links (preferably hard links) to each of the directories, then find within that master directory.

share|improve this answer
    
(My answer crossed with choroba's, but I am leaving it in because of the extra information I gave about multiple directories.) – AFH Jul 24 '14 at 17:44
    
This was perfect. I love you. – Nebur Jul 24 '14 at 22:56

Use find and its -size option:

find -size NNNc

c means the size in bytes.

share|improve this answer

You must log in to answer this question.

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