Raveen Kumar

Locate

Description

Locate is a alternative to find for files. Locate uses updatedb command to update its database. Note that we must run the updatedb command everytime there is file system change.

Example

Create a database

updatedb

Locate files

locate filename

Create a database locally

updatedb_path="$HOME/.local/locate_db"
updatedb_home="$updatedb_path/home.db"
updatedb -l 0 -o "$updatedb_home" -U ~/

Locate files for locally created database

locate -d "$updatedb_home"

#Locate #Linux #Command-Line