SSH and screen

I just learnt the amazing power of screen with ssh, and put it to use for my first time, so here’s a post 🙂 Consider you are working on some data on a remote computer/server. You can access this server, but only intermittently. Also, you dont have the patience to keep some window open to stare at the progress of your work, but would like to visit it now and then to know how much of it is complete. Screen is the answer to your problem. The work could be from running simulations (C / C++ / other Terminal executable languages) and even can be extended to Matlab! On a console-only SSH, running matlab defaults to the terminal since it cannot open a graphical interface, and this aspect is exploited here.

The most useful feature of screen is the ability to disconnect / close the terminal, without quitting the associated programs. Further, you can reconnect to this “screen” whenever you wish. The terminology used is “detach” and “attach”. Here’s how its done.

  1. SSH to your account, wherever it is…
  2. Start a session of screen by typing: screen This will auto-generate a weird session id. This can be renamed, but details later
  3. Now, start your simulation/work in this terminal.
  4. Detach: Next, you can just close this terminal window, knowing well that your work is being carried out by the server
  5. In case you want to look at the status, firstly SSH back to the account and do a screen -ls to get a list of running screens
  6. Attach: Connect to your screen by typing screen -r <name_as_in_list>, and you are back to your work!

For more details on the usage of screen, visit this nice and short tutorial.


4 thoughts on “SSH and screen

  1. dhaval

    hmm. it managed to break my comment :P. let’s try agani


    screen -s \

    and screen -x \ to share it at the same time 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s