[CentOS] get /full/path/filename.ext from filename.ext

Wed Dec 10 22:15:01 UTC 2014
Keith Keller <kkeller at wombat.san-francisco.ca.us>

On 2014-12-10, Dan Hyatt <dhyatt at dsgmail.wustl.edu> wrote:
> I don't know if this is of interest as an alternative.

It may or may not be, but it doesn't help the OP, who already knows
where the file is, and just wants the full absolute path.  locate will
not help him there, especially if there are multiple files with the same
filename.ext on that filesystem.

> I did find a cool functionality called locate  and updatedb

locate has been around for many many years, certainly since at least
CentOS 4, likely much earlier.

> The problem is that it can get stale, but you can update it before doing 
> your searches.

There is (or at least, there should be) a script in /etc/cron.daily 
which updates it nightly.

> So if you need to do a set of searches on a filesystem (or whole system)
> run updatedb on each target filesystem to create the db for that filesystem.

You can configure locate (in /etc/updatedb.conf) with which directories
to index or not index.  Then you do not need to maintain your own
indexes, you can simply use the single system index.

--keith

-- 
kkeller at wombat.san-francisco.ca.us