I use VanDyke's SecureCRT which I love to connect to my SSH servers. Sometimes though I will have multiple tabs open to the same server as I am working on installing packages in one directory, and checking changes in another. When I reboot the server, it randomly selects a session to have in it's history. I am wondering if it is possible to have all sessions have the same history file?

On someone else's suggestion (because sometimes my kids shut my laptop without asking and disconnects my sessions), I tried out the screen command earlier today. I started a session on my home computer and thought I could resume it at the office using screen -r, no such luck. I tried screen -r "pid", still no go. It was running a java file I was hoping to log back in to see the console output of at the office, but it didn't work.

I also tried the suggestions by James in post: How to get the commands issued in a ssh session to add export HISTTIMEFORMAT="%h/%d -- %H:%M:%S " to a .bash_profile file, I logged in with 3 tabs, ran a few commands, checking history in each tab, trying to scroll back without success.

Any other tips I should be aware of? I run Ubuntu 14, 16, and CentOS 6.5 - while I realize the solution for each may be different, I only mention it because if you know of any way in any system I would be happy to give it a try.

I realize it may be an odd request, and maybe even one I decide I hate if I did succeed, but I thought I would try.

1 Answer 1


See this Unix&Linux question.

The key ingredients:

  • shopt -s histappend: append to history file at shell exit, do not overwrite.

  • PROMPT_COMMAND="$PROMPT_COMMAND; history -a; history -c; history -r": before each prompt: append, clear, re-read history.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .