Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

Search files with locate

📅 2023-May-12 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ search ⬩ 📚 Archive

The locate command in Linux enables a fast search for filenames from a compiled database of the filesystem. This is similar in sprit to the Everything search tool on Windows. Note that locate is different from the find command which does a live walk of the filesystem tree and so can be very slow.

$ sudo apt install locate
$ sudo updatedb
$ locate foobar
$ locate foo*
$ locate -i foobar
$ locate -e foobar

References

Tried with: locate 4.8.0 and Ubuntu 22.04


© 2023 Ashwin Nanjappa • All writing under CC BY-SA license • 🐘 @codeyarns@hachyderm.io📧