Differences between revisions 1 and 6 (spanning 5 versions)
Revision 1 as of 2014-02-18 23:07:48
Size: 1307
Editor: bobgeorge33
Comment: Start of Screen article
Revision 6 as of 2024-01-02 13:00:06
Size: 3446
Editor: NickBannon
Comment: remove duplicate windowlist
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Once you're connected to one of UCC's servers you'll want to start running things. You could open up an SSH session for every program you want to run, or you could use a program like screen. ## page was renamed from HowToUCC/Screen
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 [[HowToUCC/SSH|SSH]] session for every program you want to run, or you could use a terminal multiplexing program like [[https://savannah.gnu.org/projects/screen|screen]] or [[https://tmux.github.io/|tmux]] . Terminal multiplexers also allow you to keep processes running even once you terminate your SSH session.
Line 3: Line 4:
To start using screen for the first time, type '''"screen"'''. This will launch the program and give you a terminal window that won't disappear when you disconnect from ssh. If you disconnect from ssh and want to reattach the the screen session you were previously running, reopen ssh and type '''"screen -dR"'''. == Screen ==
Once you have connected to the server via [[HowToUCC/SSH|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}}}
Line 5: Line 7:
|| '''Command''' || '''Key Combination'''<<BR>>(Case Sensitive) || '''Explanation''' ||
|| screen || Ctrl + a then c || Open up a new screen window ||
|| kill || Ctrl + a then k || Force Kill the current window ||
|| detach || Ctrl + a then d || Close screen. Keeps all the windows running ||
|| 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 ? || Open up a the screen help window ||
|| windowlist || Ctrl + a then " || List the open windows and allow you to go through them ||
|| '''Command''' || '''Key Combination'''<<BR>>(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) ||
Line 15: Line 17:
If your screen stops responding, try pressing "Ctrl + a then Ctrl + q" and "Ctrl + q". You may have accidentally frozen it yourself. 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 [[https://unix.stackexchange.com/questions/12107/how-to-unfreeze-after-accidentally-pressing-ctrl-s-in-a-terminal|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'''<<BR>>(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".

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