Use tmux
What is tmux?
Tmux is a terminal multiplexer
You can start a Tmux session and then open multiple windows inside that session. Each window occupies the entire screen and can be split into rectangular panes.
With Tmux you can easily switch between multiple programs in one terminal, detach them and reattach them to a different terminal.
Tmux sessions are persistent
- programs running in Tmux will continue to run even if you get disconnected. (Extremly useful when training neural netwoks on remoter server! 👏)
All commands in Tmux start with a prefix, which by default is
ctrl+b
.
Installation
On Ubuntu and Debian
sudo apt install tmux
On macOS
brew install tmux
Sessions management
Command | Shortcut | Functionality |
---|---|---|
tmux new -s session_name | creates a new tmux session named session_name | |
tmux attach -t session_name | attaches to an existing tmux session named session_name | |
tmux switch -t session_name | switches to an existing session named session_name | |
tmux list-sessions (tmux ls ) | lists existing tmux sessions | |
tmux detach | prefix +d | detach the currently attached session |
tmux renamesession -t 0 <new-name> | prefix +$ | rename session 0 to <new-name> |
Windows management
Command | Shortcut | Functionality |
---|---|---|
tmux new-window | prefix + c | create a new window |
tmux select-window -t :0-9 | prefix + 0-9 | move to the window based on index |
tmux select-window -t <window-name> | move to the window <window-name> | |
tmux rename-window <new-name> | prefix + , | rename the current window |
Panes management
Command | Shortcut | Functionality |
---|---|---|
tmux split-window | prefix + " | create a new window |
tmux split-window -h | prefix + % | move to the window based on index |
prefix + x | kill current pane |
Cheatsheet
Tmux Cheat Sheet & Quick Reference
Reference
Complete tmux Tutorial