Operating System - Linux
1827436 Members
4969 Online
109965 Solutions
New Discussion

who can do me a favor to spell the command clause between "locate" and "ls"

 
SOLVED
Go to solution

who can do me a favor to spell the command clause between "locate" and "ls"

I want to locate the files with keyword, then use ll or ls for details, however, I always fell to spell the clause,eg:
#locate route || ls
??
it can not work.
How to use the locate as input for the ls or ll?
thanks
frederick
5 REPLIES 5
Karthik S S
Honored Contributor
Solution

Re: who can do me a favor to spell the command clause between "locate" and "ls"

ll `locate route`

-Karthik S S
For a list of all the ways technology has failed to improve the quality of life, please press three. - Alice Kahn
U.SivaKumar_2
Honored Contributor

Re: who can do me a favor to spell the command clause between "locate" and "ls"

Hi,

#ll `locate sendmail` | more

` - quote in the left top of the keyboard below Esc key.


regards,

U.SivaKumar
Innovations are made when conventions are broken
Nicolas Dumeige
Esteemed Contributor

Re: who can do me a favor to spell the command clause between "locate" and "ls"

Just so you know : which and type can help you find command wich are in you path.

If you don't get a result this way, try :
find root_search_directory -name '*pattern*' -exec ls -l {} \;
All different, all Unix
U.SivaKumar_2
Honored Contributor

Re: who can do me a favor to spell the command clause between "locate" and "ls"

Hi,

please note that locate command is not used to find newly created files. In that case find command is the solution.

regards,

U.SivaKumar.
Innovations are made when conventions are broken
Rick Beldin
HPE Pro

Re: who can do me a favor to spell the command clause between "locate" and "ls"

I do something like this:

for i in `locate X11`
do
file $i
done


You get every file as new variable and then you can individually do something with it.

Another, searches contents of files I found with locate for some string:

for i in `locate filesImaybeInterestedIn`
do
echo $i
grep SomeString $i
done

You can use the same technique with find.
Necessary questions: Why? What? How? When?