TMUX/Screen Cheatsheet
TMUX and screen are extremely useful tools for maintaining sessions through reverse tunnels and other fragile connections. They allow for reconnection of sessions that become detached (disconnected) where the process is still running but there was some sort of network interruption.
They both have a very handy function where each window can be split either vertically or horizontally in to separate panes. I am not sure what the actual limit to the number of panes may be, but I regularly split my windows into four panes comfortably.
Screen is fairly ubiquitous in most Linux distributions, however TMUX is a program that will likely have to be installed on the machine you are connecting to. Screen is fairly old and does not get feature updates anymore (as far as I am aware), while TMUX is newer and has many plugins which can be used to extend its functionality. Learning both will ensure you are ready no matter which may be present on the system you log into.
^
is shorthand for the CTRL
key, so ^b
== CTRL + b
.
-----
^a
is the default meta-key for screen
, while ^b
is the default meta-key for TMUX
.
Session Management
Action | TMUX | Screen |
Start a new session |
|
|
Create a new named session |
| |
Re-attach a (local) detached session |
|
|
Re-attach an attached session (detaching it from elsewhere) |
|
|
Re-attach an attached session (keeping it attached elsewhere) |
|
|
Detach from currently attached session |
|
|
Detach and log out |
| |
List sessions |
|
|
Pane Management
Action | TMUX | Screen |
Split pane horizontally |
|
|
Split pane vertically |
|
|
Switch to another pane |
|
|
Kill the current pane |
|
|
Close all panes except the current one |
|
|
Swap location of panes |
| N/A |
Show time |
| ----- |
Show numeric identifier for all panes |
| ----- |
Window Management
Action | TMUX | Screen |
Rename window |
|
|
Create new window |
|
|
List windows |
|
|
List windows (with selection menu) | ----- |
|
Go to window $num |
|
|
Go to previously active window |
|
|
Go to next window |
|
|
Go to previous window |
|
|
MISC
Action | TMUX | Screen |
See key bindings |
|
|
Enter "scroll mode" |
|
|
Enter "Vim mode" |
Search with Hit Use | |
Scroll up in "scroll mode" |
|
|
Scroll down in "scroll mode" |
|
|
Exit "scroll mode" |
|
|
Exit current shell |
|
|
Ippsec Tmux Notes
Config from ippsec.
First press the prefix ctrl + b
(default, Ippsec changes it to Ctrl+a) then release the buttons and press the combination you want.
Join panes: prefix + s #
Zoom in/out to panes: prefix + z
Kill session by tag:tmux kill-session -t X
Kill pane: prefix + &
tmux plugins:
tmux logging plugin (get this!!) can save log of tmux windows
If you like this content and would like to see more, please consider buying me a coffee!
Last updated