Thursday, October 19, 2017

command line - How to search for files in Terminal using indexed list?



If I want to search for files in Terminal, I tend to either use something like tree --prune -P , but this can take a long time with a big directory so when it's too big I tend to revert back to the GUI (even though this is something I don't like doing very much) in order to use Nautilus's ability to use the file index (as files are indexed to increase the efficiency of the search).




But I don't like having to do this, so I was wondering if there is a way of searching through a certain directory and all of its sub-folders for files using the item index created by tracker like can be done through the GUI (I have only said 'files', but I would also like the search results to include folders)?



I am running Ubuntu GNOME 16.04 with GNOME 3.20.



I would suggest using locate while updating the database every 30 minutes (subsequent updates take far less time than the initial).



crontab entry



*/30 * * * * /usr/bin/updatedb



If you're working in any of the pruned directories, you would need to modify /etc/updatedb.conf. Or if you were only working in for instance /home/user, you could add directories to omit, and speed up updating the database.


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...