1

The find command is suddenly not returning any results, even for for files I know exist. For example, if I run:

find . -name calendar.sql

from a directory I know contains a file called calendar.sql, nothing is returned. Surrounding the name of the file with quotes doesn't help.

Not sure what is going on. I've used the command fine in the past.

  • Ah, interesting. If I slap sudo in front of it, it now works. What gives? – StevieD Apr 29 '18 at 21:41
  • It appears that somewhere in the directory path there is a subdirectory where you do not have read or execute access. – AFH Apr 29 '18 at 22:39
5

My first guess would be that you now have some other find in your path or something has defined a find function or alias.

Try /usr/bin/find . -name calendar.sql to call it directly. if that works then try which find that may discover an errant find in your PATH. Also alias will list all aliases and set | grep find will find all instances of the word find in the currently defined functions.

  • 1
    In bash, you can use type find to see what the shell thinks "find" is (i.e. whether it's an alias, function, builtin, or external command). – Gordon Davisson May 1 '18 at 2:51
  • 1
    Ugh, at some point in the past I added alias find="find . -name $1" to my bash config file. – StevieD May 1 '18 at 9:19
  • We all do it at some stage, @StevieD. I call that a "learning experience" :) – Tony Williams May 2 '18 at 0:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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