What is tmux?
According to the tmux↗ on their wiki:
tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
Keybinds
The default keybind for tmux is CTRL+B
.
Sessions
tmux [new -s <session-name>]
: Create a new session (with a name)tmux ls
: List all sessionstmux a[ttach] [-t <session-name>]
: Attach to a session (by name)tmux kill-sess[ion] [-t <session-name>]
: Kill a session (by name), if no name is provided, it will kill the most recent sessiontmux kill-sess[ion] -a
: Kill all sessions
When in a sessin you can use CTRL+B d
to detach from the session.
Windows
When you’re in a session:
CTRL+B c
: Create a new windowCTRL+B n
: Go to the next windowCTRL+B p
: Go to the previous windowCTRL+B <window-number>
: Go to a specific windowCTRL+B ,
: Rename the current windowCTRL+B w
: List all windows (use arrow keys and enter),CTRL+B &
: Close the current window
Panes
When you’re in a window:
CTRL+B %
: Split the current pane verticallyCTRL+B "
: Split the current pane horizontallyCTRL+B <arrow-key>
: Go to the pane in the direction of the arrow keyCTRL+B o
: Go to the next paneCTRL+B x
: Close the current paneCTRL+B z
: Max/minimize the current paneCTRL+B !
: Move the current pane to a new windowCTRL+B {
: Move the current pane to the leftCTRL+B }
: Move the current pane to the rightCTRL+B q
: Show pane numbers (use the number to go to that pane)CTRL+B space
: Cycle through pane layoutsCTRL+B ;
: Toggle between the current and previous paneCTRL+B CTRL+<arrow-key>
: Resize the pane in the direction of the arrow keyCTRL+B [
: Enter copy mode, “q” to exit
Conclusion
The shortcuts listed above are the ones I mostly use. It might feel daunting at first, I recommend using it with a list like this on your second monitor, the shortcuts are pretty intuitive so you’ll get the hang of it in no time.