Remote terminal sessions with GNU Screen
If you need to run a long running terminal session on a remote server, you can keep the terminal session running, even if the ssh connection gets disrupted, by using the GNU Screen program.
- screen –help (obvious)
- Check (list) if you have screen session(s) already running: screen -ls
- Reattach to an existing screen session: screen -r [session]
- Start a new sesssion with a meaningful name: screen -S sensiblename
Screen’s default session names are based on the process ID, so if you have multiple sessions running, you’ll probably forget which was which later on, unless you give them a more explanatory name instead.
- Within a screen session, screen’s own commands start with <ctrl>+a (written C-a here).
- In-program help, show key commands: C-a ?
- Detach a screen session from the terminal (so that it can continue to run in the background): C-a d
If your connection is disrupted, you can just ssh in again later, and then reattach an existing session, as noted above.
Remote terminal sessions with GNU Screen / Use/Less by blogadmin is licensed under a Creative Commons Attribution CC BY 3.0