3 ms·
I guess the downside of this is that ctrl+r would only search the current day's history? Personally I at least increased the history kept with HISTFILESIZE=5000
by dale-cooper 11y ago
I guess the downside of this is that ctrl+r would only search the current day's history? Personally I at least increased the history kept with HISTFILESIZE=500000 and HISTSIZE=5000
- snogglethorpe 11y agoAnother issue is that it looks like would start a new history file only when a new shell is started. Some people log in fresh every day, but I've got terminal windows on my home machine that have been sitting around for many months... I guess you'd have to set the history-size etc large enough to hopefully last for the maximum expected shell run-time. EDIT: hmm, the man page says you can just unset HISTFILESIZE or set it to a non-numeric/negative value to avoid truncating the history file at all.
- michaelhoffman 11y agoYeah, I have this as well: export HISTSIZE=65535 # why not? export HISTFILESIZE=65535 export HISTCONTROL=ignoredups but now I'm wondering if I should unset `HISTFILESIZE` insteead.
- myhf 11y agoIt can also be nice to use HISTCONTROL=ignorespace If you're planning on keeping a lot of history, ignorespace makes it easy to avoid inserting commands with sensitive info. A well-placed $(cat) can work too. $ PASSWORD=hunter2 # sensitive info doesn't go into history $ curl -O http://name:$PASSWORD@server/path # command with correct syntax does go into history
- seqizz 11y agoThere is another reply defining histgrep() function. Maybe ctrl+r could be assigned somehow.
- haddr 11y agoYou can still use ctrl+r, but you need to provide the history file in one piece, using "history -r <file>" command. I do it in the following way, maybe it can serve you too: cat `find "${HOME}/.history" -type f | grep -v ".allhistory"` > ${HOME}/.history/.allhistory history -r ${HOME}/.history/.allhistory