Locate - command not found

Command ‘locate’ not found, but can be installed with:
sudo apt install mlocate # version 0.26-3ubuntu3, or
sudo apt install plocate # version 1.0.4-4

hi, can’t use locate for searching files in terminal, what I should install instead please? thanks

Well, you can install it if you want to. The thing is that those two packages are essentially rewrites of the original. ArchLinux does a good job of explaining.

That said, I prefer find. For example, if I wanted to find all files with “lubuntu” in the name in a case insensitive manner:

sudo find / -type f -iname *lubuntu* 2>/dev/null

The reason for the sudo is to allow access to all files. Even then, there are some that will produce errors, thus the reason to ignore errors with 2>/dev/null.

Neither of those is necessary if you’re working with directories that you don’t need to elevate permissions to. For example, if you want to see if you have any ISOs in your Downloads folder:

find ~/Downloads -type f -iname *.iso

You can even use find to perform actions on all the files it finds. It’s pretty powerful stuff.

4 Likes

Like @wxl, I think the find tool is pretty handy, I also use mlocate and that is useful too. I would also like to point out that pcmanfm-qt has some fairly good search functionality as well. screenshot81
You can access it via the tool menu item or F3

3 Likes