From Storrs HPC Wiki
Revision as of 17:23, 19 February 2016 by Cdk10001 (talk | contribs)
Jump to: navigation, search

What is Screen

Screen is a full-screen software program that can be used to multiplexes a physical console between several processes (typically interactive shells). It offers a user to open several separate terminal instances inside a one single terminal window manager, making it easy to manage detached jobs.

Using Screen with the HPC Cluster

Why you should use it

When you lose connection from the internet such as wiki, you can reattach your jobs back to terminal through screen. Generally speaking, there are 4 advantages as below:

  • 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.

Where to use it

Only the login nodes install the screen. i.e. only

How to use it

To start using screen

  • Simply run "screen"
 [xinli@cn65 ~]$ screen

Congratulations, you are now inside of a window within screen. This functions just like a normal shell except for a few special characters.

Creating Windows

  • Command: “Ctrl-a” “c”
  • Specification: To create a new window, you just use “Ctrl-a” “c”.

This will create a new window for you with your default prompt. Your old window is still active. For example, I can be running top and then open a new window to do other things. Top stays running! It is still there. To try this for yourself, start up screen and then run top. (Note: I have truncated some screens to save space.)

Switching Between Windows

  • Command:
    • Go to next window: “Ctrl-a” “n”
    • Go to previous window: “Ctrl-a” “p”
  • Specification: Screen allows you to move forward and back. In the example above, you could use “Ctrl-a “n” to get back to top. This command switches you to the next window.The windows work like a carousel and will loop back around to your first window.You can create several windows and toggle through them with “Ctrl-a” “n” for the next window or “Ctrl-a” “p” for the previous window.Each process will keep running until you kill that window.

Reattach to Screen

If your connection drops or you have detached from a screen, you can re-attach by just running:

 [xinli@cn65 ~]$ screen -r

This will re-attach to your screen. However, if you have multiple screens you may get this

 [xinli@cn65 ~]$ screen -r
 There are several suitable screens on:      (Detached)      (Detached)
 Type "screen [-d] -r [pid.]" to resume one of them.

If you get this, just specify the screen you want.

 [xinli@cn65 ~]$ screen -r

More Information

For more help visit GNU screen website. screen has functionality beyond just resuming and detaching from sessions.