[ALUG] 'locate' isn't always helpful, how to do better?

Paul lists at bulldoghome.com
Thu Feb 22 11:09:16 GMT 2007


Hi Chris

On Thursday 22 February 2007 10:50, Eur Ing Chris Green wrote:
> While the 'locate' command is very useful at times, especially if you
> have lost a specific file it's much less useful when looking for, for
> example, a directory which has a rather common name.

My first reaction was use `find`, but....

> I know I can use an RE in locate but it's not all *that* simple to
> come up with an RE to do it.

A quick look at `man locate` shows that it provides many of the same options 
as find. If it is a directory you seek, use `-type d`, and to limit the depth 
of search, add `-maxdepth 3` - None of which involve gnarly regexs ;)


Regards, Paul.



More information about the main mailing list