Use locate command to find files in Linux

locate is a very useful command, which can be use from time to time to find files in Linux when we don’t know where that file is.

sudo apt update
sudo apt install locate
sudo updatedb # need to let sometime for this to finish 
locate .bashrc # locate can be called from anywhere 
locate -c "*thingtosearch" # search by regex, show count
locate -e "*thingtosearch" # search in real-time, regardless db not updated.
locate -i "*thingToSearch" # search and ignore case
locate -S # view locate db                                                           at  10:56:54
Database /var/cache/locate/locatedb is in the GNU LOCATE02 format.
Database was last modified at 2020:10:07 10:38:37.467600124 +0200
Locate database size: 5860142 bytes
All Filenames: 464048
File names have a cumulative length of 34300427 bytes.
Of those file names,

	1317 contain whitespace, 
	0 contain newline characters, 
	and 32 contain characters with the high bit set.
Compression ratio 82.92% (higher is better)
Add to my src(1)

No account yet? Register

Spread the love

Leave a Comment