index.html :: rss :: github :: telegram :: email

tmux: cheatsheet

02 Nov 2024

Learning new tricks, making some notes.

Ctrl-b c - create a new tab

Ctrl-b 0..9 - switch tabs

Ctrl-b p/n - switch to previous or next tab

tmux new-session -A -s <name> - start new session with name OR attach to existing session

tmux ls - list active sessions

tmux attach-session -t 0 -d - attach to a session, -t 0 to specify a session number, -d to detach other clients.

Ctrl-b d - detach from a current session

Ctrl-b [ - enter copy mode: "space" to visual-block selection, "shift-V" for visual-line selection, "enter" to copy text.

Ctrl-b PageUP - enter copy mode and jump one page backward, useful to scroll logs.

Ctrl-b % - split screen vertically

Ctrl-b <arrows> - switch between splits

SSH into tmux:

ssh -t user@host tmux new-session -A -s "MACHINE@SSH"

-t - request tty, MACHINE@SSH is a session name, just a distinguish enough value for status line.

or directly from ssh_config:

Host host-tmux
    Hostname 10.0.0.1
    RequestTTY yes
    RemoteCommand tmux new-session -A -s "MACHINE@SSH"


Reading:

tmux-plugins/tmux-sensible: basic tmux settings everyone can agree on.

make tmux pretty and usable: a guide to customizing your tmux.conf.

cool status bar examples.