Redirected from page "HowToUCC/Screen"

Clear message

Once you're connected to one of UCC's servers you'll want to start running things. Unfortunately you only have a single terminal interface which can only run a single foreground process at a time. You could open up a SSH session for every program you want to run, or you could use a terminal multiplexing program like screen or tmux . Terminal multiplexers also allow you to keep processes running even once you terminate your SSH session.

Screen

Once you have connected to the server via SSH, run screen. This will launch the program and give you a terminal window that won't disappear when you disconnect from ssh. If you disconnect or log out, then want to reattach the the session you were previously running, log back in and type: screen -dR

Command

Key Combination
(Case Sensitive)

Action

screen

Ctrl + a then c

Create/open a new window

kill

Ctrl + a then k

Kill the current window (typing exit from the window achieves a similar result)

detach

Ctrl + a then d

Detach this session (the windows continue to run), use screen -r to reattach later

windowlist

Ctrl + a then "

List all windows and switch between them interactively

title

Ctrl + a then A

Set the title for the screen window

next

Ctrl + a then n

Go to the next screen window

prev

Ctrl + a then p

Go to the previous screen window

help

Ctrl + a then ?

Display the help window with the command keys (bindings)

A full list of command keys (bindings) can be found in the man page for screen under the section "Default Key Bindings".

If your screen stops responding, try pressing "Ctrl + a then Ctrl + q" and "Ctrl + q". You may have accidentally frozen it yourself due to flow control commands .

Tmux

After logging in to the server, simply run tmux to begin. You will be placed into a new terminal window from which you can run commands as usual. Tmux's "prefix" key is <C-b> (i.e. "Ctrl + b") so that one can run screen inside tmux or vice versa without clashing). Type that, then type a command key to perform actions such as switching windows, detaching, adding a new window, etc. Similar to screen, detaching tmux allows you to keep processes running after terminating your session. A few useful command keys include:

Command

Key Combination
(Case Sensitive)

Action

new-window

Ctrl + b then c

Create/open a new window

detach-client

Ctrl + b then d

Detach this session (the windows continue to run), use tmux attach to reattach later

choose-tree

Ctrl + b then w

List all windows and switch between them interactively

kill-pane

Ctrl + b then x

Kill the current window (typing exit from the window achieves a similar result)

list-keys

Ctrl + b then ?

Display the help window with the command keys (bindings)

A full list of command keys (bindings) can be found in the man page for tmux under the section "Default Key Bindings".