Damn Small Linux (DSL) Forums
Welcome, Guest. Please login or register.
December 05, 2023, 03:31:35 PM

Login with username, password and session length
The new DSL forums are now open.
11609 Posts in 311 Topics by 291 Members
Latest Member: mik3ca
Search:     Advanced search
* Home Help Search Login Register
Get The Official Damn Small Linux Book. Great VPS hosting provided by Tektonic

+  Damn Small Linux (DSL) Forums
|-+  Damn Small Linux
| |-+  DSL Ideas and Suggestions
| | |-+  $locate ? would be a nice addittion
« previous next »
Pages: [1] Print
Author Topic: $locate ? would be a nice addittion  (Read 8957 times)
Posts: 8

View Profile
« 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.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by SMF 1.1.20 | SMF © 2013, Simple Machines
Mercury design by Bloc