Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #286726
| From | David Wright <deblis@lionunicorn.co.uk> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: (slightly OT?) Disk usage of find |
| Date | 2026-05-17 05:30 +0200 |
| Message-ID | <MVAmt-5IPa-1@gated-at.bofh.it> (permalink) |
| References | <MVrCx-5CHc-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Sat 16 May 2026 at 14:06:57 (-0400), rhkramer@gmail.com wrote:
> I tend to avoid the use of find (1) because I never really "internalized" the
> syntax) and (2) on the assumption that it hits the disk "harder" than locate.
>
> I mean, updatedb runs once a day (on my systems) and I assume (I know) that
> its database is mostly cached somewhere, but I don't really know how it finds
> new files.
>
> Is there any validity to the idea that find is harder on disks (hits them more
> often / more widely) than locate?
No idea. When I unmount storage devices, I run locate to index them,
but also generate a ls-lR.gz, and a compressed sorted listing of all
the files (full-time, size, path) and their directories.
(It's a bit slow generating all that for a large NTFS volume.)
Of these three indexes, I use the locate .db the least, and most
frequently zgrep the listing. Generating all three archive files
is for my convenience, not the hardware's.
As for the complexities of find, that's easy to deal with. Write them
into bash functions when complicated (I've just posted one), and also
keep one-liners in your command recall buffer. So, for example, I can
type "find" and press ↑ several times to recall a command like:
find . -type f -mmin -1440 -printf '%Ta%TH:%TM:%.5TS%11s %P\n' | sort -n -k 2 | less # one day by size
That's useful when your browser or some fancy GUI thingy saves a
file and you don't have a clue where it went. (If that just happened,
I would line-edit the 1440 to 10, 2 to 3, and . to relevant high-level
directories, and get a listing by name of all the files modified
in the last ten minutes. The default is documented by the comment.)
I have a battery of such command lines, and I can modify them after
recalling them, to fit the task in hand. eg:
find ~/scores/ ~/Lilylib/ \( -name \*.ly -o -name \*.ily -o -name \*.lily \) -exec grep -H -i 'x' {} \; | sort | less # display lines
and that one has a companion to display matching files rather than
just the matching lines:
less $(find ~/scores/ ~/Lilylib/ \( -name \*.ly -o -name \*.ily -o -name \*.lily \) -print | sort | while read j; do grep -l -i -e 'x' "$j"; done) # display files
Cheers,
David.
Back to linux.debian.user | Previous | Next — Previous in thread | Find similar
(slightly OT?) Disk usage of find rhkramer@gmail.com - 2026-05-16 20:10 +0200
Re: (slightly OT?) Disk usage of find Andy Smith <andy@strugglers.net> - 2026-05-16 20:50 +0200
Re: (slightly OT?) Disk usage of find "mick.crane" <mick.crane@gmail.com> - 2026-05-17 01:00 +0200
Re: (slightly OT?) Disk usage of find Andrew Latham <lathama@gmail.com> - 2026-05-16 21:40 +0200
Re: (slightly OT?) Disk usage of find Chime Hart <chime@hubert-humphrey.com> - 2026-05-16 20:30 +0200
Re: (slightly OT?) Disk usage of find David Wright <deblis@lionunicorn.co.uk> - 2026-05-17 05:30 +0200
csiph-web