Differences between revisions 3 and 4
Revision 3 as of 2024-01-02 11:12:16
Size: 2538
Editor: ConorBennett
Comment: Generalised scope to include other terminal multiplexing programs like tmux
Revision 4 as of 2024-01-02 12:49:36
Size: 3321
Editor: NickBannon
Comment: Link to SSH, reduce reference to it, link to screen and tmux homepages, make descriptions more similar, use {{{}}} code more consistently
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
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 an 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. 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 5: Line 5:
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 from ssh and want to reattach the the screen session you were previously running, reopen ssh and type '''"screen -dR"'''. 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 7: Line 7:
|| '''Command''' || '''Key Combination'''<<BR>>(Case Sensitive) || '''Explanation''' || || '''Command''' || '''Key Combination'''<<BR>>(Case Sensitive) || '''Action''' ||
Line 9: Line 9:
|| kill || Ctrl + a then k || Force Kill the current window || || kill   || Ctrl + a then k || Force Kill the current window ||
Line 11: Line 11:
|| 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 ||
|| 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 17: 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]] .
Line 20: Line 22:
After SSHing 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"), which you can press followed by 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 SSH session. A few useful command keys include: 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:
Line 22: Line 24:
|| '''Command Key''' || '''Action''' ||
|| c || Create a new window. ||
|| d || Detach tmux. Use {{{tmux attach}}} to reattach. ||
|| w || List all windows and switch between them interactively. ||
|| x || Kill the current window. Alternatively running {{{exit}}} from the window also achieves the same result. ||
|| '''Command''' || '''Key Combination'''<<BR>>(Case Sensitive) || '''Action''' ||
|| new-window || Ctrl + b then c || Create a new window. ||
|| detach-client || Ctrl + b then d || Detach tmux. Use {{{tmux attach}}} to reattach. ||
|| choose-tree || Ctrl + b then w || List all windows and switch between them interactively. ||
|| kill-pane || Ctrl + b then x || Kill the current window. Alternatively running {{{exit}}} from the window also achieves the same result. ||
|| list-keys || Ctrl + b then ? || Display the help window with the command keys (bindings) ||
Line 28: Line 31:
A full list of command keys can be found in the {{{man}}} page for tmux under the section "Default Key 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

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 ?

Display the help window with the command keys (bindings)

windowlist

Ctrl + a then "

List the open windows and allow you to go through them

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 a new window.

detach-client

Ctrl + b then d

Detach tmux. Use tmux attach to reattach.

choose-tree

Ctrl + b then w

List all windows and switch between them interactively.

kill-pane

Ctrl + b then x

Kill the current window. Alternatively running exit from the window also achieves the same 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".