Screen: The lifesaver tool to work with remote ssh sessions

You are working with a remote server ssh session in your client computer, maybe you are compiling something or you are running a long run script, but for some reason you must shut down or restart your computer, the power is out , you accidentally close the wrong window or network connection fails. What happens?? All your tasks running on the server has gone!!

This never happen again with the screen tool! Because you can create a permanent shells that run even if the ssh window is closed or the network fails.

With the Screen tool you can:

  • Use multiple shell windows from a single SSH session.
  • Keep a shell active even through network disruptions.
  • Disconnect and re-connect to a shell sessions from multiple locations.
  • Run a long running process without maintaining an active shell session

In a debian-like distro (like Raspberry Pi raspbian) to install screen you only must do:

sudo apt-get install screen

And runs with that command:

screen

When screen is running you can use the Ctrl-a command to control the screen, with Ctrl-a + c you can create a new screen window, and hoy can navigate through windows with Ctrl-a + n and Ctrl-a + p.

If you want to detach the screen session, you can use Ctrl-a + d, but the magic is here:  you can close the window, and when you reconnect, you can use the #screen -r command you can reattach you sessions, even if you don’t detach the screen session properly because you connection fail, the screen is detached automatically!!!

Info taken from: http://www.rackaid.com/blog/linux-screen-tutorial-and-how-to/

Posted in Linux, Raspberry Pi Tagged with: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*