Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Why command find -cmin +20 in Linux CentOS always returns 1 record which is .? How can I work around this?

share|improve this question
It seems to work fine for me when I try a find /path/to/search -cmin +20 -ls (-ls prints/list the found filenames. It is the default on many install but explicitly using it is a good idea. Same with the /path/to/search which defaults to . – Hennes Apr 11 '13 at 9:17
yes, but try this: find -cmin +20 | wc -l it will always returns 1 even if your current catalog is empty. – Krystian Apr 11 '13 at 9:20
mkdir test, cd test, find -cmin +20 | wc -l. My output is 0. – Hennes Apr 11 '13 at 9:24
What are the timestamps on both files ls -la . ? – Hennes Apr 11 '13 at 9:29
hmmm...indeed, when I did same thing my result was 0 too. Weird, because in my existing catalog it always returns 1. I had to del mentioned catalog, and create it once again and now it works good. EDIT: described catalog was empty all the time – Krystian Apr 11 '13 at 9:29
up vote 0 down vote accepted

When you don't enter a specific path for find to look at, at least GNU find will default to search recursively from and including the current directory, i.e. .. Verbatim from man find:

If no paths are given, the current directory is used.

If you don't want to include the path argument itself in the results, add -mindepth 1. Once again from man find:

-mindepth levels
   Do not apply any tests or actions at levels less than `levels` (a
   non-negative integer). `-mindepth 1` means process all files except
   the command line arguments.


~$ mkdir test
~$ cd test
~/test$ find
~/test$ find -mindepth 0
~/test$ find -mindepth 1

With your specific command, find will always return at least one record if the current directory itself is older than 20 minutes. Creating a new directory as you did will then not return anything, since it won't match the search criteria — at least not for 20 minutes after its creation.

share|improve this answer
Aye. That is why I asked "What are the timestamps on both files ls -la ." (one of those would be the dir itself). ;-) – Hennes Apr 11 '13 at 11:10

Your Answer


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.