TMUX is a powerful tool that allows you to manage multiple terminal sessions within a single window. This guide covers the basics and some customization tips to enhance your terminal experience.
On Debian-based systems, you can install tmux using:
sudo apt install tmux
-
Start a new session:
tmux
-
The Prefix Key:
- TMUX uses a prefix key to distinguish its commands from regular terminal input.
- The default prefix is
Ctrl+b
. Press this before any TMUX command.
-
Detach from a session:
- Press the prefix, then
d
- Press the prefix, then
-
List all sessions:
tmux list-sessions
- Or use the shortcut: prefix +
s
- Or use the shortcut: prefix +
-
Attach to a session:
tmux attach -t [session-name] # Shorthand version: tmux a -t [session-name]
- To attach to the most recent session:
tmux a
- To attach to the most recent session:
-
Rename a session:
- prefix +
$
- prefix +
-
Split vertically: prefix +
%
-
Split horizontally: prefix +
"
-
Navigate panes: prefix + arrow keys
-
Close a pane:
- Type
exit
or - prefix +
x
- Type
- Create a new window: prefix +
c
- Navigate windows:
- Previous: prefix +
p
- Next: prefix +
n
- Previous: prefix +
- Close a window: prefix +
&
- Rename a window: prefix +
,
While TMUX works great out of the box, customizing it can improve your workflow and aesthetics.
-
Create a config file:
nano ~/.tmux.conf
-
Example customizations:
# Use C-j and C-f as prefix keys set-option -g prefix C-j set-option -g prefix2 C-f # Easier window splitting bind-key v split-window -h bind-key h split-window -v
For a quick start with great customizations, check out this popular config: gpakosz/.tmux
Remember, the beauty of TMUX lies in its flexibility. Experiment with different settings to find what works best for you. Happy multiplexing!