5

I'm running an install task on Pi and my connection to pi dropped. How can I relogin to previous session so can view install progress.

In future I should log output to file (so can view progress by opening file if similar situation occurs)?

  • 3
    You're looking for gnu-screen or tmux. – Ghanima Apr 15 '15 at 20:37
8

Try using the "screen" program. Install it with:

sudo apt-get install screen

Now after you ssh into the pi, type screen and press enter. You are now inside a "screen". You can go about your work like normal.

To disconnect from the screen, simply type. "ctrl-a, d". To be clear, this means first hit ctrl and a at the same time, then release both keys, then press d.

To resume after your ssh session has dropped, simply ssh back in, and type screen -r. If you have more than one screen session running, you can type screen -ls to see all of them, and then connect to a specific one with screen -r 1234 where 1234 is the first number listed on the line.

4

Two cool tools simplify your life with respect to the issue of reconnecting to a session lost during a connection drop: gnu screenand tmux. Those two also offer nice and useful features that come in handy and that is the multiplexing of several virtual consoles. This is especially helpful to control multiple programs on the command line interface from just a single terminal or via one remote terminal session.

To add to portforwardpodcast's answer just another little advice to aid usability. Invoke screen -S apt to create a session called "apt" (or whatever you like). This way the session can be easily resumed by screen -r apt without the need to list all the existing sessions first.

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.