Solved

Linux and finding a directory name

Posted on 2014-11-15
1
416 Views
Last Modified: 2014-11-15
I can find a name as follows:

[root@mmclnt13 home]# cd util
[root@mmclnt13 util]# ls
net
[root@mmclnt13 util]# find . -type f -name "net"
./net
[root@mmclnt13 util]#

Open in new window


However I have difficulty finding directory names

[root@mmclnt13 util]# cd ..
[root@mmclnt13 home]# ls
download  hosts  util
[root@mmclnt13 home]# find . -type f -name "util"
[root@mmclnt13 home]#

Open in new window


Is there a command to find both names and directory names when searching ?

Thanks
0
Comment
Question by:Anthony Lucia
1 Comment
 
LVL 23

Accepted Solution

by:
savone earned 500 total points
ID: 40444664
Your using type -f which means it is looking for "files".

find . -type d -name "util"

Will look for directories.

If you want to fine both files and directories name "util" just remove the "type"

find . -name "util"
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using 'screen' for session sharing, The Simple Edition Step 1: user starts session with command: screen Step 2: other user (logged in with same user account) connects with command: screen -x Done. Both users are connected to the same CLI sessio…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now