tmux
Updated at 2018-06-28 20:12
tmux
is a terminal multiplexer that allows easily running multiple applications in the same terminal and keeping everything as a detached process.
What I do is I simply have tmux
starting command in .bashrc
. This has added benefit that most IDEs that offer terminals will also start tmux
automatically.
# automagical tmux if not already in a tmux session
if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then
tmux attach-session -t default || tmux new-session -s default
fi
tmux
is especially useful when connecting to remote hosts and want to keep tabs.
You start, attach to and detach from tmux
sessions. A single machine can have many tmux
sessions running.
Sessions (current session shown bottom left in [brackets])
> Windows (windows are shown in bottom bar, current marked with *)
> Panes (tiled sections of a window, active highlighted with green borders)
I use 100% vanilla tmux
keybindigs for easier cross-system usage.
Tab keybindings:
tmux
Start defaulttmux
session.ctrl+b, c
Create a new window with a single pane.ctrl+b, 0-9
Jump to a specific window.ctrl+b, "
Split pane horizontally.ctrl+b, %
Split pane vertically.ctrl+b, arrows
Select another pane.ctrl+b, ctrl+arrows
Resize selected pane.ctrl+b, z
Maximize/normalize selected pane.ctrl+b, !
Move current pane to a new dedicated window.ctrl+b, x
Close the current window.
Session keybindings:
ctrl+d
End of Transmission -signal like normal, closes active pane.ctrl+b, d
Detach from the session, leaving it running in the background.tmux a
Attach back to detachedtmux
session
Browsing keybindings:
ctrl+b, [
Enter copy mode for copy-paste, browsing and such.ctrl+b, [, ctrl+s
Search in terminal,n
for next,N
for previous.ctrl+b, [, arrows, ctrl+space, arrows, alt+w
Copy totmux
clipboard.ctrl+b, ]
Paste fromtmux
clipboard.