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).
Best Answer
The following options would be applicable:
To save every command before it is executed (this is different from bash's history -a solution):
To read the history file everytime history is called upon as well as the functionality from
inc_append_history
:These can be set in your
.zshrc
file.⚠️ Either set
inc_append_history
orshare_history
but not both. (see comments bellow)share_history
is enabled, it reads and writes to the history file.inc_append_history
is enabled, it only writes to the history file.Related for bash: