Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
General
cancel
Showing results for 
Search instead for 
Did you mean: 

how do i look for a directory which i cant find...

bob the spod
Occasional Advisor

how do i look for a directory which i cant find...

Im frantically searching directories within directories to find a directory!

Is there a cmd i can kick off from home to go find it?

I know it exists out there somewhere... What would you suggest?
you make me feel like dancing (gonna dance the night away!)
6 REPLIES
Pete Randall
Outstanding Contributor

Re: how do i look for a directory which i cant find...

Use find:

find /dir -type d -name *name*


Pete

Pete
Jeff Schussele
Honored Contributor

Re: how do i look for a directory which i cant find...

Hi Bob,

Yep, use find as follows

find /start_dir -type d -name dir_name

The first dir name (start_dir) is where the top of the search tres will be i.e. nothing above it in the actual dir tree will be searched, but everything below will. If your not 100% sure of the target dir name you can use wildcards as follows

-name "*abc*"

This would find anything containing the string "abc"

Rgds,
Jeff
PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Cheryl Griffin
Honored Contributor

Re: how do i look for a directory which i cant find...

How about find:
# find /home/cherylg -name 234 -print
/home/cherylg/abc/123/234

replace /home/cherylg with the path that you want to start the search from.
replace 234 with the name of the directory you want to find.
"Downtime is a Crime."
Dario_1
Trusted Contributor

Re: how do i look for a directory which i cant find...

Hi!

find / -type d -name dirname -print

Regards,

DR
Cheryl Griffin
Honored Contributor

Re: how do i look for a directory which i cant find...

Dario,
There is usually no need to traverse the system by starting from /. It would be quicker to give it a starting point where you know the directory might be. "find /" should be a last resort.
"Downtime is a Crime."
Dario_1
Trusted Contributor

Re: how do i look for a directory which i cant find...

Cheryl:

I agree with you, but he's searching directory within directory to find a directory. My command will search the entire system avoiding the execution of the command in every mount point.

Regards,

DR