LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-18-2013, 09:17 PM   #1
chonk0
LQ Newbie
 
Registered: Apr 2013
Posts: 12

Rep: Reputation: Disabled
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?
 
Old 04-18-2013, 09:22 PM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,131
Blog Entries: 2

Rep: Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833Reputation: 4833
you have to specify the name with the -name option:
Code:
 find / -name pr0n -type d
 
Old 04-18-2013, 09:25 PM   #3
chonk0
LQ Newbie
 
Registered: Apr 2013
Posts: 12

Original Poster
Rep: Reputation: Disabled
Smile

Quote:
Originally Posted by TobiSGD View Post
you have to specify the name with the -name option:
Code:
 find / -name pr0n -type d
I found the pr0n!

Thanks
 
Old 04-21-2013, 01:16 PM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
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
 
Old 04-21-2013, 01:32 PM   #5
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to find the directory and remove the directory swathikumar Linux - Newbie 3 11-21-2011 01:38 PM
[SOLVED] Find a directory shik28 Linux - Newbie 7 09-20-2011 01:21 AM
Find directory older than x and mv directory with sub files command ajhart Linux - Newbie 4 07-15-2011 06:24 AM
[SOLVED] Find Directory only doby48 Linux - Newbie 4 07-19-2010 05:14 PM
find exactly in that directory basak Linux - Newbie 1 08-21-2006 09:26 AM


All times are GMT -5. The time now is 11:51 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration