Skip to main content

Posts

Showing posts from April, 2008

Linux Live Search...

So... The other day I decided to set up 'locate' to find files in my home network shares, /home/ghostis and /sandbox/ghostis. To do so, I did the following:


% mkdir /home/ghostis/Documents/locate

Added the an updatedb job to my crontab on my laptop:

15,30 * * * * updatedb --netpaths='/home/ghostis /sandbox/ghostis' --output=/home/ghostis/Documents/locate/locatedb --localpaths=' '

Now I can do faster searches of filenames via:

locate -d ~/Documents/locate/locatedb sometextinfilename


But, then I thought, "What's the absurd extreme?"
Linux Live Search!
So I baked a quick bash script:

% cat linux_live_search.sh


#!/bin/bash
clear
echo "Please type something. (Escape spaces. Ctrl-C to quit)"
echo "------------------------------------------"
echo "Query: $WORD"
echo "------------------------------------------"
while read -s -n1 KEY
do
clear
if [ "$KEY" = "" ]
then
WORD=`echo "$WORD"| sed -e …