Super User is a question and answer site for computer enthusiasts and power users. 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 often need to ssh to a build machine (on ubuntu) for building software. But sometime, my connection to the machine is disconnected (e.g. due to Wifi not stable).

Is there anyway I can 'reconnect my old ssh session? so that I can keep my build job?

Now, the build job on build machine still runs but i have no idea when it will end in my new ssh shell.

Thank you.

share|improve this question

Off the top of my head I can think of two tools:

  • Screen is a full-screen window manager that multiplexes a physical terminal between several processes, typically interactive shells. It allows you to disconnect from the server but keep your session running.
  • Mosh Mobile shell, which is a remote terminal application that allows roaming, supports intermittent connectivity.

Screen has been around for a long time and I've personally used it several times. It's really handy. Mosh is the new kid on the block and looks really interesting. I haven't gotten around to test driving it yet.

share|improve this answer
+1 for screen. I actually have my login script configured to automatically start a screen session if one is not running, or reconnect to an existing one if there is one running. Just add screen -aAxRUO to the bottom of your .profile in your home directory on the server! This will even allow you to connect to the same SSH session from multiple computers at the same time. – Darth Android Aug 15 '12 at 21:11
@Darth Nice tip. Didn't now about the -aAxRUO switch :P – djf Aug 15 '12 at 21:14
Well, it's more like 6 :P It basically says "Do whatever you have to to get me a screen session now", plus UTF-8 support. – Darth Android Aug 15 '12 at 21:16

tmux is another option to check out.

From the tmux homepage:

tmux is a terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached.

share|improve this answer

You must log in to answer this question.

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