Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 have multiple PuTTy sessions open to my SunOS 5.10 server, and I am using ksh, and SOMETIMES the command history is shared among the different sessions and SOMETIMES it is not. I cannot figure out what determines whether it is or is not shared. By shared what I mean is that a command run in one session will be seen as previous command run in another session.

I prefer it not to be shared, is there a config setting for that?

share|improve this question

Most Unix shells read old history from a file, once – when the shell is started – and when you close that shell, the history is written to the file again.

Usually the old contents are simply overwritten, so if you do something like...

  1. login to sessions A and B
    • A and B read the same contents of ~/.history
  2. run command test in A
    • A adds test to its in-memory history
    • B doesn't know about the command
  3. logout from A
    • A overwrites ~/.history with its history, which has test
  4. login to session C
    • C reads contents of ~/.history, with test
  5. logout from B
    • B overwrites ~/.history with its history, which doesn't have test
  6. logout from C
    • C overwrites ~/.history with its history, which has test

then test will be saved to the history file after step #3, but step #5 will discard it, and step #6 will add it again...

Some shells have an "append history" option that avoids this (e.g. shopt -s histappend in Bash).

If you want to have completely separate histories, an easy way is to just symlink your history file to /dev/null.

share|improve this answer

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.