There is a directory under /tmp with the name test_copy.

$ ls /tmp/test_copy/
a.sh b.sh  

$ cd /tmp  
/tmp$ find . -name test_copy  

But if I run the following find command it does not return anything.

~/scripts$ find /tmp -name test_copy  

Why can't find find the directory in the last case?

  • 3
    What is the result of ls -ld /tmp?
    – xhienne
    Jan 4, 2017 at 22:28
  • 2
    @xhienne: You are right! It was a symlink to another dir. Can you post it as an answer?
    – Jim
    Jan 4, 2017 at 22:32

1 Answer 1


If /tmp is a symbolic link, find won't enter the directory and will just stop, finding nothing.

On the other hand, any of the following commands will work:

find -H /tmp -name test_copy
find /tmp/ -name test_copy

(the ending / dereferences the symlink)

  • 1
    This is likely to be the case on macOS in particular. On macOS, /tmp is a symlink to /private/tmp or some such.
    – kojiro
    Jan 5, 2017 at 3:08

You must log in to answer this question.

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