Solved

Linux and finding a directory name

Posted on 2014-11-15
1
389 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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
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…

743 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

10 Experts available now in Live!

Get 1:1 Help Now