Tmux is a terminal multiplexer that allows multiple terminal sessions to be accessed simultaneously in a single window.
Sessions can be sent to the background and re-attached later. If the connection drops, the session continues running in the background.
Shortcuts
- ctrl+b %
- splits the window vertically;
- ctrl+b “
- splits the window horizontally;
- ctrl+b left|right|up|down
- navigates between panes;
- ctrl+b c
- creates a new window;
- ctrl+b 0
- selects window 0;
- ctrl+b ,
- renames the current window;
- ctrl+b d
- detaches the session (keeps the session running in the background);
Sessions
- tmux ls
- lists active sessions;
- tmux attach -t 0
- attaches to session 0;
- tmux rename-session -t 0 new_name
- renames session 0 to new_name;
- tmux new -s session_name
- creates a new named session;
- tmux kill-session -t 0
- closes session 0;
Resizing panes
- ctrl+b :
- :resize-pane -U 5
- :resize-pane -D 10
- :resize-pane -L 15
- :resize-pane -R 20
To enable mouse support for selecting and resizing panes, create the file ~/.tmux.conf and add set -g mouse on.
A full list of commands is available at [Link].
An alternative to Tmux is Screen:
sudo apt install screen screen