Difference between revisions of "Screen Tutorial"
Chris Tyler (talk | contribs) |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:SPO600]] | |
+ | When performing a long interactive operation such as a complex test or build over a remote connection (such as [[SSH]]), any network interruption such as a temporary break in WiFi connectivity or relocating from one pace to another will interrupt the operation and force you to start over. | ||
+ | |||
+ | [https://www.gnu.org/software/screen/ GNU screen] is a utility which addresses this problem by enabling you to disconnect from a terminal session and reconnect from the same or a different location later. It also has a number of advanced features such as multiple sessions over a single connection and session sharing between multiple users. This tutorial covers the most basic and useful use-case. | ||
+ | |||
+ | # Connect to a system, either by logging in locally or logging in remotely via [[SSH]]. | ||
+ | # Start screen: <code>screen -RaD</code> | ||
+ | #* The <code>-RaD</code> options tell screen to start a session if none exists, or take over an existing session is one does exist, and to detach any existing remote connections to that session. | ||
+ | # Perform whatever operations you desire. | ||
+ | # Disconnect by pressing '''Ctrl-A''' then '''D'''. | ||
+ | # You can now disconnect/close your local login or ssh connection. | ||
+ | # To resume from the same or other location, issue the command from step 2. | ||
+ | |||
+ | For additional details, see the manpage for screen. | ||
+ | |||
+ | === Alternatives === | ||
+ | |||
+ | An alternative to screen is [https://tmux.github.io/ tmux]. | ||
+ | |||
+ | For a similar disconnect/reconnect capability for graphical applications, see [https://en.wikipedia.org/wiki/Virtual_Network_Computing VNC]. |
Latest revision as of 15:40, 8 November 2021
When performing a long interactive operation such as a complex test or build over a remote connection (such as SSH), any network interruption such as a temporary break in WiFi connectivity or relocating from one pace to another will interrupt the operation and force you to start over.
GNU screen is a utility which addresses this problem by enabling you to disconnect from a terminal session and reconnect from the same or a different location later. It also has a number of advanced features such as multiple sessions over a single connection and session sharing between multiple users. This tutorial covers the most basic and useful use-case.
- Connect to a system, either by logging in locally or logging in remotely via SSH.
- Start screen:
screen -RaD
- The
-RaD
options tell screen to start a session if none exists, or take over an existing session is one does exist, and to detach any existing remote connections to that session.
- The
- Perform whatever operations you desire.
- Disconnect by pressing Ctrl-A then D.
- You can now disconnect/close your local login or ssh connection.
- To resume from the same or other location, issue the command from step 2.
For additional details, see the manpage for screen.
Alternatives
An alternative to screen is tmux.
For a similar disconnect/reconnect capability for graphical applications, see VNC.