Searching files on linux

To find files quickly on the redhat based distributions (fedora,centos,rhel,etc)

search files

You need to first index the file names before you can search them quickly for this command is

updatedb &
man updatedb

& (lets you to run the command in background so you can do something now
in shell in mean time)

then after it is done.

you can find files using command locate

locate [filename or part of filename]

Example

[xxx@server1 plugins]$ locate wysiwyg
/scripts/wysiwygpro_cleanup
[xxx@server1 plugins]$
man locate
You have to update the index periodically else it will be outdated and not pretty useful as it should be

so add this to your cron job to make it run once daily
$crontab -e
1 1 * * * /usr/bin/updatedb

This will update it daily to the db

If you dont want to index it daily & If your files rarely change you
can change it weekly or monthly by just changing it accordingly on crontab

making , editing crontab is out of subject of this article but the
simple way is

crontab -e & paste that cron command and then save it.

Online Cron command generator




Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment:

Google