4 ms·
I just write all my commands to a log. It's saved me a number of times. https://spin.atomicobject.com/2016/05/28/log-bash-history/ https://spin.atomicobject.co
by vietjtnguyen 6y ago
I just write all my commands to a log. It's saved me a number of times.
https://spin.atomicobject.com/2016/05/28/log-bash-history/ https://spin.atomicobject.com/2016/05/28/log-bash-history/
- varenc 6y agoYou can do this easily with zsh’s standard features. I love having years of my command history! It's all combined across sessions and instantly searchable with the standard ^R. These are most of the settings in ZSH I use to enable all that. HISTSIZE=10000000 SAVEHIST=10000000 setopt EXTENDED_HISTORY # logs the start and elapsed time setopt INC_APPEND_HISTORY setopt SHARE_HISTORY setopt HIST_IGNORE_DUPS setopt HIST_IGNORE_ALL_DUPS setopt HIST_FIND_NO_DUPS Apple now even recommends zsh shell over bash! =) https://support.apple.com/en-us/HT208050 https://support.apple.com/en-us/HT208050 (it's the 10.15 default)
- MachineGunPablo 6y agoyes, `EXTENDED_HISTORY` is all you need... And BTW I think HIST_IGNORE_DUPS` is not needed if you set `HIST_IGNORE_ALL_DUPS`
- kinleyd 6y agoThank you, this was so timely. My zsh terminals have been saving my command history but, for reasons I didn't know, were not displaying them. I'm much pleased to have that sorted out.
- TwoNineFive 6y ago> Apple now even recommends zsh shell over bash! Worth reading why they did that: https://thenextweb.com/dd/2019/06/04/why-does-macos-catalina-use-zsh-instead-of-bash-licensing/ https://thenextweb.com/dd/2019/06/04/why-does-macos-catalina...
- dmortin 6y agoYes, it's useful. It's even better if you can search your commands with out of order matching (multiple words in any order). I do this from Emacs (you can use Helm or Ivy, for example) and it's extremely convenient and effective to quickly get old commands back.
- pletnes 6y agoXonsh lets you log history to a sqlite database. It’s a nifty feature for analysing what you’re doing in your shell and AFAIK it keeps the start/stop/elapsed time too.