Tmux Cheat Sheet
Introduction
Tmux is an open-source terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window.
It is useful for running more than one command-line program at the same time. It can also be used to detach processes, allowing remote sessions to remain active without being visible.
Cheat Sheet
Tmux comes with a lot of built-in commands, although these are the main ones I use while performing day-to-day operation:
Command | Description |
tmux ls/tmux list-sessions | List open sessions |
tmux/tmux new-session | Start a new session |
tmux new -s stef | Start a new session and call it stef |
tmux kill-session -t stef | Kill the stef session |
tmux attach-session -t stef | Attach o the stef session |
[CTRL+B] + $ | Rename current session |
[CTRL+B] + d | Detach from current session |
[CTRL+B] + c | Create new windows |
[CTRL+B] + , | Rename current window |
[CTRL+B] + 0-9 | Switch to a different window |
[CTRL+B] + & | Close current window |
[CTRL+B] + % | Split pane vertically |
[CTRL+B] + “ | Split pane horizontally |
[CTRL+B] + ↑↓→← | Switch to a different pane based on direction |
[CTRL+B] + CTRL + ↑↓→← | Resize width/height of current pane |
[CTRL+B] + x | Close current pane |
[CTRL+B] + [ | Enter copy mode (used to scroll up/down) |
/ (while in copy mode) | Search forward |
? (while in copy mode) | Search backward |
n (while in copy mode) | Jump to next occurrence (while searching) |
N (while in copy mode) | Jump to previous occurrence |
Conclusion
Tmux is a phenomenal that can help massively improve productivity by allowing to have any number of split panes, windows and sessions that can allow to run several tasks simultaneously.
It is also a lot more configurable than a normally terminal and it has really useful functionalities like the ability to log every command automatically to a log file.