Tmux Reference For Managing Kubernetes Cluster

Tmux is a terminal multiplexer that helps us split our terminal into multiple panes and run sessions

We can watch logs in one pane, run kubectl in the other, and never lose our work if the connection drops, using control+b.


Aliases (add to ~/.bashrc or ~/.zshrc)

alias tmux-s='tmux new-session -A -s t0'
alias tmux-v='tmux new-session -A -s t0 ; split-window -v 2>/dev/null || tmux split-window -v'
alias tmux-h='tmux new-session -A -s t0 ; split-window -h 2>/dev/null || tmux split-window -h'
alias tmux-d='tmux detach'
alias tmux-k='tmux kill-session -t t0'

After adding, reload your shell:

source ~/.bashrc   # or source ~/.zshrc

Usage

List sessions by running tmux ls or tmux list

AliasWhat it does
tmux-sStart a plain session (or reattach if already running)
tmux-vStart with vertical split — panes top and bottom
tmux-hStart with horizontal split — panes side by side
tmux-dDetach — session keeps running in background
tmux-kKill the session entirely

Keybindings (inside tmux)

All keybindings start with the prefix key: Ctrl+b

KeysWhat it does
Ctrl+b ←Move to left pane
Ctrl+b →Move to right pane
Ctrl+b ↑Move to upper pane
Ctrl+b ↓Move to lower pane
Ctrl+b zZoom pane fullscreen (toggle)
Ctrl+b dDetach (same as tmux-d)

Typical Workflow

tmux-h          # start session with two panes side by side
                # left pane: watch logs
                # right pane: run kubectl commands

Ctrl+b ←→      # switch between panes

tmux-d          # detach when done — session keeps running

tmux-s          # reattach later from any terminal

tmux-k # kill session

List sessions by running tmux ls or tmux list

Ctrl+b →Move to the right pane & Ctrl+b ←Move to the left pane

tmux-kKill the session entirely

tmux has exited

(Visited 7 times, 1 visits today)

By Ash Thomas

Ash Thomas is a seasoned IT professional with extensive experience as a technical expert, complemented by a keen interest in blockchain technology.