On 8/10/25 3:14 AM, Johannes Altmanninger wrote:
On Sat, Aug 09, 2025 at 02:30:34PM -0400, Matt Corallo wrote:I tend to use bash_history as a way to remember specific commands to run for various tasks, often quite irregularly, and thus keep HISTFILESIZE quite large (800k lines in my .bash_history, for 32MiB).Not a real solution but maybe history deduplication (which can be nice for other reasons) would reduce the need for a large history.
This already exists; look at the HISTCONTROL shell variable and the `erasedups' value it can contain. If you want to do it as a one-time operation, write your history to a file, run the `hist_erasedups' program that's included as an example in the readline distribution, and read the history list back from the output.
(Instead of parsing history up-front, one could also store the entire ~/.bash_history in memory verbatim, and decode it whenever accessing history. Not saying that this is more elegant than the arena approach, but it's probably an option)
I don't see this as a big win, since the real cause of fragmentation is appending new entries to the in-memory history list. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
OpenPGP_signature.asc
Description: OpenPGP digital signature