LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   find directory (https://www.linuxquestions.org/questions/linux-newbie-8/find-directory-4175458700/)

chonk0 04-18-2013 09:17 PM

find directory
 
Hi,

When searching for a directory using:

find / pr0n -type d

I always end up getting the "find: `pr0n': No such file or directory" even though I know the directory name is correct.

What am I doing wrong?

TobiSGD 04-18-2013 09:22 PM

you have to specify the name with the -name option:
Code:

find / -name pr0n -type d

chonk0 04-18-2013 09:25 PM

Quote:

Originally Posted by TobiSGD (Post 4934455)
you have to specify the name with the -name option:
Code:

find / -name pr0n -type d

I found the pr0n!

Thanks

David the H. 04-21-2013 01:16 PM

Please use ***[code][/code]*** tags around your code and data, to preserve the original formatting and to improve readability. Do not use quote tags, bolding, colors, "start/end" lines, or other creative techniques.

The basic syntax of find is this:

Code:

find <search dirs> <global opts> <test opts> <actions>
There can be multiple entries for any of these, and all of the options and actions start with '-'. So it thought you had given it two starting directories to search.

It's also a good idea to always give your command an explicit "-print" action. While this is the default anyway when no action is given, in more complex cases it can be necessary.

Here are a couple of good links about using find:
http://mywiki.wooledge.org/UsingFind
http://www.grymoire.com/Unix/Find.html

shivaa 04-21-2013 01:32 PM

@chonk0:
Adding to David's reply, just follow the man page of find cmd here. It has all answers for your question.


All times are GMT -5. The time now is 09:38 PM.