shell cmd: locate rev 1 jun 2023 >> info | usages: update db | get basename | limit paths to search | regex | ignore case >> resources ....................................................... > Info * Faster than `find` because it searches its database. * May not return all if something has been added or deleted recently, before the dabase got updated. * Different distributions may have different implementations installed: mlocate - merging locate slocate - secure locate plocate - ? locate Replacement for mlocate, except "when multiple strings are searched, plocate returns only the files that match all the search strings, rather than any file that matches even one string." and "compatible with systemd and SELinux." with slightly different usages. $ man locate to see what your options are. ....................................................... > update the locate database: * it runs periodically by itself, usually every 24 hr. * You can update it with $ sudo updatedb ......................... > get only the basename: i.e., exclude any results that have the search term in the path, but not in the base file/directory name # -b, --basename $ locate -b '/Thisthing' $ locate '*/Thisthing' $ locate Thisthing | grep '/Thisthing$' More: - https://unix.stackexchange.com/questions/40015/how-can-i-use-locate-only-for-a-directory Lots of examples. apr 2012 - jun 2022, as of jun 2023 - https://unix.stackexchange.com/questions/39528/restrict-search-of-locate-to-specific-directories may 2012 - nov 2021, as of jun 2023 ......................... > limit paths to search Looks like you can limit what paths it searches in the updatedb, but it's a hassle to limit in the results. $ man updatedb PRUNE_BIND_MOUNTS, PRUNEFS, PRUNENAMES and PRUNEPATHS variables, documented in detail in updatedb.conf(5). * How to add specific directories to "updatedb" (locate) search path? https://unix.stackexchange.com/questions/151700/how-to-add-specific-directories-to-updatedb-locate-search-path aug 2014-may 2020, as of jun 2023 ......................... > regular expressions: plocate -r uses regex - but then it's as slow as just using find. ......................... > ignore case: $ locate -i ....................................................... > Resources: * Locate command in linux https://linuxize.com/post/locate-command-in-linux/ Good basic explanation. pub 19 nov 2020 * 10 locate command examples in Linux [Cheat Sheet] https://www.golinuxcloud.com/locate-command-in-linux/ date? * Command line - plocate https://www.linux-magazine.com/Issues/2022/254/Location-location-location pub 2022 _______________________________________________________ begin 1 jun 2023 -- 0 --