Chapter 26. locate, slocate, and rlocate

Sometimes you need to find a file right now, and you don’t want to search for it in one directory after another, and running find from the root directory takes forever on your humongous system.

That’s the time to locate the missing file. Or slocate it, depending on your distribution. There is just one problem with using locate or slocate, and that’s staying up to date. Here’s how they work and how to use them, and a brief tease on rlocate, their nimble, more timely, heir apparent.

Finding a File

Slocate and locate both do essentially the same thing: search a database containing the file names and locations on the system for a match and report all that are found.

Both count on another program—updatedb—to do ...

Get CLI for Noobies: A Primer on the Linux Command Line now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.