4 ms·
locate is not mentioned -- two orders of magnitude faster than find for searches from '/' on my laptop, e.g. find / -name \*bashrc\* locate bashrc Faster
by everybodyknows 6y ago
locate is not mentioned -- two orders of magnitude faster than find for searches from '/' on my laptop, e.g.
find / -name \*bashrc\*
locate bashrc
Faster because reading from a single binary cache file, updated nightly, rather than opening every directory inode under /. To force an immediate synchronous update of the cache:
sudo updatedb
- yewenjie 6y agoThere is also `fd` [1] which is written in Rust and very fast alternative to `find` with a simpler syntax. 1. https://github.com/sharkdp/fd https://github.com/sharkdp/fd
- cft 6y agolocate relies on indexing crons. This has killed several production servers until I disabled it.
- lighttower 6y agoHave you tried FZF? [1] Fuzzy matching. It's loaded as a vimplug but binds to bash. It even fuzzy matches your bash history (CTRL-R). [1] https://github.com/junegunn/fzf https://github.com/junegunn/fzf
- stinos 6y agoRelying on a database which gets updated nightly is problematic for some usage though in at least 2 ways: I don't leave my computer on if I'm not using it so there's a good chance the db will simply never update (I guess?) plus it's only usable for locating files with confidence if you know they're system files or else they were on the system yesterday. Or, you run updatedb manually all the time and weep because that's not something instant, at all. All in all, the idea is good, but I'm almost sure there are better implementations (even Windows has tools like 'Everything' which use a database but which gets continuously updated).
- aerique 6y agoEven running updatedb (except the initial run) and then running locate might be faster than running a recursive grep from the root directory. Definitely if you run that grep more than once.
- scbrg 6y agoThere are cron implementations that handle the "turned off at night" problem. anacron is one of them.
- everybodyknows 6y ago>you run updatedb manually all the time and weep because that's not something instant, at all. No, not instant, YMMV. On my mid-range laptop with SATA SSD: $ time sudo updatedb real 0m0.501s user 0m0.247s sys 0m0.218s
- fomine3 6y agoIs there any alternatives like "Everyting" on Windows? I really like it for its GUI and depending NTFS index which is immediately updated.
- joyj2nd 6y agonothing beats recoll
- nocitrek 6y agoI recommend going with fzf. I can search my whole hard drive with fuzzy expressions (e.g. "find all files which are in home directory and ends with .py" == search: home py$). Both home and / directories are searched completely within 2-3 seconds, just enough time for you to type what you are searching for. High recommendation.