Damn Small Linux (DSL) Forums

Damn Small Linux => DSL Ideas and Suggestions => Topic started by: kswoodsman on September 08, 2012, 08:56:52 PM

Title: $locate ? would be a nice addittion
Post by: kswoodsman on September 08, 2012, 08:56:52 PM
OK so realising that a full blown database of where all the files reside  isn't feasible for a <50 meg distro. How about adding an alias to bashrc or bash_aliases that reads similar to

alias locate="du -ah / 2>&1| cut -f 2 | grep" for an output simular to full locate
alias locate="du -ah / 2>&1| grep" to show the file allocation size ?

The first instance takes a minute to complete. Every instance afterwards it is read from cached memory and the results are nearly instantaineous.

In ways, the alias is a bit better than using updatedb, which only runs once per day, any new files or newly mounted filesystems are immediately available and no diskspace is used on a read-only fs.

I haven't looked at the kernel cache useage before and after first use. Low memory machines (<32M) haven't seemed to suffer from this alias. The kernel keeps track of stale caches and flushes them regularly. Symlinks are shown as 0K in size if not piped through cut. And you get a quick ide of file size wlithout having to run ls -l once the file you are looking for is found.

Thanks for your eforts making DSL what it has evolved into, a great distribution that is portable and consistant from one machine to the next.

Powered by SMF 1.1.20 | SMF © 2013, Simple Machines