Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I generally find myself using two or three tabs in my Terminal on OS X.

A minor inconvenience is often that the tabs don't share a command history. So things like history | grep thingIamlooking for don't get me where I want to be.

Is there a way of focing Terminal tabs to share history, or some other historyofalltabs command?

share|improve this question
+1. I have the same problem – revolver Jul 26 '12 at 9:20
up vote 13 down vote accepted

I don't think there is a way to share history amongst TerminalTabs only, but here something that could help you.

The history is not something handle by your terminal but by your shell (bash, tcsh, zsh...)

here some options that'll help you setup a shared history amongst all the terminal windows (the shell instances).

this should be put somewhere in your .bashrc file.

export HISTCONTROL=ignoredups:erasedups  # no duplicate entries
export HISTSIZE=100000                   # big big history
export HISTFILESIZE=100000               # big big history
shopt -s histappend                      # append to history, don't overwrite it

# Save and reload the history after each command finishes
export PROMPT_COMMAND="history -a; history -c; history -r; $PROMPT_COMMAND"
share|improve this answer
+.5 for good answer, +.5 for good grammar ;) – Matt Jul 26 '12 at 9:49
Does it means, i've used a good grammar or you're being ironic ? English isn't my native language so if there is errors feel free to edit my post or tell me where i'm wrong :) – Lifely Jul 26 '12 at 11:54
I was referring to your use of amongst ;) – Matt Jul 26 '12 at 12:04
Apologies for the late accept. :s – Joe Oct 28 '12 at 19:22
@Lifely's solution isn't working for me in El Capitan. At all. Even the max length of the history file. Is there a new solution since 2012? (I'd have commented above, but don't have the rep) – JP Duffy Apr 26 at 20:17

Your Answer


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.