I consistently have more than one terminal open. Anywhere
from two to ten, doing various bits and bobs. Now let's say I restart
and open up another set of terminals. Some remember certain things, some
forget.
I want a history that:
ANSWERS:-
I want a history that:
- Remembers everything from every terminal
- Is instantly accessible from every terminal (eg if I
ls
in one, switch to another already-running terminal and then press up,ls
shows up) - Doesn't forget random things if there are spaces at the front of the command.
ANSWERS:-
# avoid duplicates..
export HISTCONTROL=ignoredups:erasedups
# append history entries..
shopt -s histappend
# After each command, save and reload history
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
0 comments:
Post a Comment
Don't Forget to comment