Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can it be achieved so that every command that is entered, is visible in every open terminal's history?

When having multiple terminals open, the history isn't shared, i.e. what you entered in one terminals history, doesn't show up in another one. Think of an alternative to Bash's PROMPT_COMMAND="history -a" (which saves the history before the prompt is beeing displayed).

share|improve this question
    
See also related and advanced Q&A: superuser.com/questions/446594/… –  lumbric Dec 22 '13 at 18:27

1 Answer 1

up vote 19 down vote accepted

In the .zshrc file, the following values accomplish this:

  • To save every command before it is executed (this is different from bash's history -a solution):

    setopt inc_append_history
    
  • To retrieve the history file everytime history is called upon.

    setopt share_history
    

Related for bash:

share|improve this answer
    
"SHARE_HISTORY: This option both imports new commands from the history file, and also causes your typed commands to be appended to the history file (the latter is like specifying INC_APPEND_HISTORY, which should be turned off if this option is in effect)." (From manual emphasis added) i.e. just the INC_APPEND_HISTORY option will do what you want. –  artfulrobot yesterday

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.