LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   updatedb every time? (https://www.linuxquestions.org/questions/linux-newbie-8/updatedb-every-time-190991/)

akudewan 06-08-2004 01:35 AM

updatedb every time?
 
Whenever I have to locate files (created recently) I have to "updatedb". It gets very boring, and I have to locate files quite often. Is there any other way to look for files? Or any better method?

btmiller 06-08-2004 02:13 AM

updatedb should run as a cron job. Go to your /etc/cron.daily directory and see if there's a script in there that runs updatedb. If not, you can create one by creating a new file (name is not important, but call it something descriptive -- it's called slocate on my Slackware 9.1 system) with the following contents:

Code:

#!/bin/sh

/usr/bin/updatedb -c

You'll need to change the location of updatedb if it is not located in /usr/bin on your system (it usually is -- type which updatedb to be sure). If this file already exists, probably cron is not running -- it should be started out of Slackware's /etc/rc.d/rc.M file -- make sure the line with crond is uncommented.

If you want to search for files that were created between the last updatedb time and the present, you'll want to use the find command. It has massive numbers of options, but the general form to find a file by name is:

find <directory> -name <name>

which starts a recursive search in <directory> looking for files of name <name>. If you want to use wildcards in the name, you'll have to put it in quotes.

Demonbane 06-08-2004 03:37 AM

'find' should be alright if you're able to narrow down the location of the file you want to search to a certain extent.

akudewan 06-08-2004 11:35 AM

Thanks btmiller & Demonbane. Updatedb is running as a cron job. "Find" is a good option. Thanks for the help


All times are GMT -5. The time now is 10:47 PM.