⇤ ← Revision 1 as of 2014-02-18 23:07:48
1307
Comment: Start of Screen article
|
2496
Added section about tmux, rewrote article to be about terminal multiplexing in general
|
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. | 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. |
Line 3: | Line 3: |
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 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"'''. |
Line 16: | Line 17: |
== Tmux == 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: || '''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. || A full list of command keys 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 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.
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 from ssh and want to reattach the the screen session you were previously running, reopen ssh and type "screen -dR".
Command |
Key Combination |
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 |
If your screen stops responding, try pressing "Ctrl + a then Ctrl + q" and "Ctrl + q". You may have accidentally frozen it yourself.
Tmux
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:
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. |
A full list of command keys can be found in the man page for tmux under the section "Default Key Bindings".