Home > Uncategorized > Brilliant locate & updatedb (linux/cygwin)

Brilliant locate & updatedb (linux/cygwin)

September 1st, 2013 Leave a comment Go to comments
The great thing about using Linux is discovering some utility that you didn’t know about and then wondering how you ever lived without it!

My latest find is locate which is a file finder it is super fast because it uses a database. You need to update this database every now and again with updatedb (on cygwin make sure you run as administrator).

The only hiccup is that you can’t specify exact filename match. I’ve adapted a small script to achieve this.

examples of locate
> locate php.ini

and here’s a useful trick

> cp -p $(locate bridge) /tmp/

> cp -p $(locate “*suki*.jpg”) /tmp

note I have to quote wildcards and match the whole string

I also find this handy ( as php.ini is often in different locations on various boxes)

> vi $(locate php.ini)

Categories: Uncategorized Tags:
  1. No comments yet.
  1. No trackbacks yet.