News for hackers. Stuff that matters.
Re:How and Why to Log Your Bash History by ag_47 on Tuesday May 31, 2016 @01:26PM (#11808175)
I do the opposite and maybe weird - I disable history, and keep the history file contents hand curated. Whenever I come up/across/use a command I'd like to keep for future or use frequently, it gets appended to the history file.
Re:How and Why to Log Your Bash History by theoh on Tuesday May 31, 2016 @01:50PM (#11808450)
Do you use the fc command (shell builtin in the case of bash) to access the history? Or just up-arrow to scroll through the options?
Re:How and Why to Log Your Bash History by ag_47 on Tuesday May 31, 2016 @02:10PM (#11808661)
Ctrl+R (reverse fuzzy lookup) -- In my early days, I quickly found it very annoying to have to scroll through garbage to get to the command I want.
Re:How and Why to Log Your Bash History by tedks on Tuesday May 31, 2016 @01:52PM (#11808469)
Do you have an alias or something else that facilitates that, or do you just do it manually?
Re:How and Why to Log Your Bash History by ag_47 on Tuesday May 31, 2016 @02:19PM (#11808745)
Never bothered to fully automate it, tbh.

I use `unset HISTFILE` to make sure when I exit the history file doesn't get all the cruft in. Every now and then I might do some housecleaning, including going through the history file then `cp ~/.bash_history{,.2}` to keep a clean copy around.

As far as saving, heres a handy function: `getlast() { fc -ln "$1" "$1" | sed '1s/^[[:space:]]*//' }`