TMUX Guide
Complete guide to using TMUX terminal multiplexer for managing multiple terminal sessions
TMUX Guide
Introduction
TMUX (Terminal Multiplexer) is a powerful terminal management tool that allows you to run and manage multiple terminal sessions from a single window. It is particularly useful for developers and system administrators who need to manage multiple tasks simultaneously.
Installation
To install TMUX on your system, use the following commands based on your operating system:
Ubuntu/Debian:
sudo apt-get update
sudo apt-get install tmuxCentOS/RHEL:
sudo yum install tmuxmacOS (using Homebrew):
brew install tmuxBasic Usage
Starting a TMUX Session
To start a new TMUX session:
tmuxTo start a session with a specific name:
tmux new -s session_nameDetaching and Attaching to Sessions
To detach from the current TMUX session and return to the regular terminal:
Ctrl+b dTo list all active TMUX sessions:
tmux lsTo attach to a specific session:
tmux attach -t session_nameTo attach to the last session you were working on:
tmux aCreating and Managing Windows
To create a new window within a session:
Ctrl+b cTo switch between windows:
Ctrl+b n # Next window
Ctrl+b p # Previous window
Ctrl+b <window_number> # Switch to a specific window by numberTo rename the current window:
Ctrl+b ,Creating and Managing Panes
To split the current window horizontally:
Ctrl+b "To split the current window vertically:
Ctrl+b %To navigate between panes:
Ctrl+b arrow_key # Use arrow keys to navigateTo resize panes:
Ctrl+b :resize-pane -D # Resize down
Ctrl+b :resize-pane -U # Resize up
Ctrl+b :resize-pane -L # Resize left
Ctrl+b :resize-pane -R # Resize rightSynchronizing Panes
To send the same command to multiple panes simultaneously:
Enter command mode:
Ctrl+b :Type:
setw synchronize-panes onTo turn off synchronization:
setw synchronize-panes offCopy Mode
To enter copy mode:
Ctrl+b [To scroll up and down:
Up/Down arrow keys or PgUp/PgDnTo start selecting text:
SpaceTo copy the selected text:
EnterTo paste the copied text:
Ctrl+b ]Customizing TMUX
TMUX can be customized via the .tmux.conf file located in your home directory. Here are some common customizations:
Set prefix key to Ctrl+a:
set -g prefix C-a
unbind C-b
bind C-a send-prefixEnable mouse support:
set -g mouse onChange status bar color:
set -g status-bg colour235
set -g status-fg colour136Useful Commands
Kill a specific window:
Ctrl+b &Kill a specific pane:
Ctrl+b xKill a TMUX session:
tmux kill-session -t session_nameConclusion
TMUX is an incredibly versatile tool that can greatly enhance your productivity by allowing you to manage multiple terminal sessions efficiently. With this guide, you should be able to get started with TMUX and use its basic features. As you become more comfortable with TMUX, you can explore its extensive customization options to tailor it to your workflow.