Skip to content

Using gnu screen

Michael Hulse edited this page Jul 9, 2018 · 5 revisions

Quick tutorial

# Detach -- if inside a screen session, it will leave the session open but return you to your previous terminal window
$ screen -d
# Reattach:
$ screen -r
There are several suitable screens on:
        32272.pts-0.server1      (Detached)
        16363.pts-1.server1      (Detached)
# If multiple, it will list the PID of the session, use that with -r to reattach to that specific session:
$ screen -r 16363

Navigation

  • Next screen window:
    control + a + n
  • Previous screen window:
    control + a + p
  • Clone (add a new one):
    control + a + c
  • Detach:
    control + a + d
  • Close the current window:
    $ exit (if in the last remaining window it terminates the screen session)

Example

Java app running on server:

  1. Using commands above, find screen session you want to access
    Note: Screens are connected to users, so you might need to sudo su <username>
  2. If app is running, quit it using control + C
  3. Assuming there’s changes you want from version control: $ git pull
  4. Restart the app: $ gradle run
  5. Detach screen (see commands above)
  6. $ exit (or close your terminal window)

Links

Clone this wiki locally