I have a laptop I bring to work and back home. At work, I often set up a lot of shells and open ssh connections. When I go back home, I have to restart all these connections, after logging into my home network, and then the VPN. It's a bit of a hassle to set up everything if I have a lot of shells open, a lot of ssh connections, servers started, and environment variables exported.

Is there any way I can maintain this setup so it would be ready for me to use when I get home?

I was thinking of setting up a separate box in my cube at work, and work on that box at work. When I get home, I could remote desktop into that box and all my sessions would be ready for me to use. However, I'd much rather be able to avoid the lag that remote desktop entails.

The only alternative I can think of is to write an Apple script to relaunch some commonly used SSH connections, export variables, launch servers, etc... So I'd have to restart everything but I'd be able to automate it. Unfortunately, my setup often changes so time spent maintaining the script might outweigh its advantages.

Info particular to me: My laptop is a Macbook pro. All the servers I log into are Linux.

  • 1
    Couldn't you do this by setting up screen or tmux sessions and then accessing them when you get back home? – terdon Jan 2 '14 at 23:36
  • 1
    Use mosh combined with screen/tmux. – Sami Laine Jan 3 '14 at 8:32
  • will these work if I need to login to a VPN? As in after I log in, will mosh/screen/tmux allow me to be up and running again? – barrrista Jan 3 '14 at 22:02
  • Yeah, a VPN does not affect that in any way. – Kevin Panko Jan 9 '14 at 19:56

I suggest using "screen" using screen allows you to maintain a running shell even if your connection drops for some reason, you can still connect to the screen you previously used. "screen" has some other nice features like collaborate a single shell with other users (look for sreen -m and screen -x )

your best friend after running screen for the first time is Ctrl-A + ? ( that's pressing control A and then ?)

good luck


You can use mosh instead of SSH if you want mobility

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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