find and locate commands return nothing

I’ve tried (as both root user and regular user) to find files using “find” and “locate” but both return nothing. How do i figure out what’s wrong?

On 02/05/2013 06:56 PM, 6tr6tr wrote:
> “locate” . . . return nothing

did you install the package findutils-locate with YaST or how?

did you do that over 24 hours ago?

if less than 24 hours ago, did you you force the daily cron to run, or
did you run updatedb before you tried the locate command?

show us the output of


locate vmlinuz


dd
openSUSE®, the “German Engineered Automobile” of operating systems!

And on the ‘find’ side of thing I’m going to ask basic questions that
should have been answered already (no offense intended, but you’ve been
here a while; if you have not read this, please do so now as it will get
you better/faster answers:
http://www.catb.org/~esr/faqs/smart-questions.html )

Which version of (presumably) openSUSE are you using?
Where did you run the command?
Was there anything in the current working directory (as specified by ‘.’)
to be found via ‘find’?
If you change directories does this help?
What was the EXACT command/path used? How do you know it “[returned]
nothing” (worded another way: post your output)?
Does this work on other systems?
Why are you running ‘find’ in the first place (provide the business case,
please; presumably you’re trying to find something, but what and why?)?

Good luck.

opensuse 12.1

Tried it in multiple folders both as root and non-root.

Yes.

find did not “find” anything despite the files being there.

No.

I was in my home directory (and other directories as well after it didn’t work). And I first did “ls” to see what was in there and saw the file “testing.txt” so I issued the command:

find -type f -iname "*test*"

That did nothing.

Literally, nothing. It just acted as though I’d hit “enter” after a blank command line. It went to the next prompt but did nothing and printed nothing. There was no output.

Yes. And thank you for that question because it helped me discover the problem. For some reason on my current system, it doesn’t print out error messages. On another system I entered the same command and it said I needed a path preceeding the search. So I entered it with a “.” and suddenly I’m finding stuff!

So I guess the real problem is why isn’t “find” telling me what errors it has?

On 02/05/2013 11:16 PM, 6tr6tr wrote:
> find -type f -iname “test

what happens if you just type


find test


dd

It says “find: `test’: No such file or directory”.

I get the same issue even if I type “find testing.txt” which is the name of the file in that folder.

try with ‘find -name tes*’

that should find testing.txt no matter where you are, in that folder or not, along with all the files starting with tes , if you want the exact name then ‘find -name testing.txt’
Of course, it will search only on that partition.

yes, that works.

Why does -iname not work without a path but -name does?

On 02/06/2013 12:26 AM, 6tr6tr wrote:
> It says “find: `test’: No such file or directory”.

i suspect your system is royally screwed up…how, that happened i don’t
know, but i guess your system administrator needs more self study and
closer adherence to standard practices…


dd

gzenum wrote:
> 6tr6tr;2524882 Wrote:
>> It says “find: `test’: No such file or directory”.
>>
>> I get the same issue even if I type “find testing.txt” which is the
>> name of the file in that folder.
>
> try with ‘find -name tes*’
>
> that should find testing.txt no matter where you are, in that folder or
> not, along with all the files starting with tes , if you want the exact
> name then ‘find -name testing.txt’
> Of course, it will search only on that partition.

No. You must quote arguments in the expression, otherwise the shell
expands wildcards and find never gets to see them.

FWIW, I never ever run find without an explicit path. Saves figuring out
various weird ways to go wrong.

6tr6tr wrote:
> gzenum;2524895 Wrote:
>> try with ‘find -name tes*’
>>
>> that should find testing.txt no matter where you are, in that folder or
>> not, along with all the files starting with tes , if you want the exact
>> name then ‘find -name testing.txt’
>> Of course, it will search only on that partition.
>
> yes, that works.
>
> Why does -iname not work without a path but -name does?

You haven’t posted any examples of the actual commands you ran and the
actual output you saw. Nobody can diagnose properly without evidence.

I did. When I tried ‘find -type f -iname “test”’ I got nothing. No output.

6tr6tr wrote:
> djh-novell;2525007 Wrote:
>> 6tr6tr wrote:
>>> gzenum;2524895 Wrote:
>>>> try with ‘find -name tes*’
>>>>
>>>> that should find testing.txt no matter where you are, in that folder
>> or
>>>> not, along with all the files starting with tes , if you want the
>> exact
>>>> name then ‘find -name testing.txt’
>>>> Of course, it will search only on that partition.
>>> yes, that works.
>>>
>>> Why does -iname not work without a path but -name does?
>> You haven’t posted any examples of the actual commands you ran and the
>> actual output you saw. Nobody can diagnose properly without evidence.
>
> I did. When I tried ‘find -type f -iname “test”’ I got nothing. No
> output.

I apologize, you did post that one line. But you didn’t post an ls of
the directory so we could be sure what the results ought to be. And in
every other claim that you made you didn’t post actual computer output,
you paraphrased it.

BTW, the answer to your original question is: Use the -D option.