[Wylug-help] locate (Was: RAID, mdadm and df)

Smylers Smylers at stripey.com
Fri Sep 24 14:18:39 UTC 2010


John Hodrien writes:

> $ locate -r '/sbin/*resize*'
> /sbin/resize2fs

I didn't know what the -r switch did, so looked it up. Thanks, that
sounds useful (all these years I've been piping the output of locate
into grep, unnecessarily).

However, I think you got lucky that the above command worked! It matches
any path which contains "/sbin" then zero or more "/"s then "resiz".

For the benefit of anybody else playing along at home, I suspect what
you actually meant was one of these (which are equivalent):

  $ locate -r '/sbin/.*resize'
  $ locate '*/sbin/*resize*'

Or if you just wanted to search /sbin/ (and not include /usr/sbin/, and
any other sbin/ directories) then it'd be one of these:

  $ locate -r '^/sbin/.*resize'
  $ locate '/sbin/*resize*'

Smylers



More information about the Wylug-help mailing list