Tmux Snippets

less than 1 minute read

Collection of simple/handy commands and my .tmux.conf.

.tmux.conf


set-option -g history-limit 10000
set -g prefix M-b  // change prefix to Alt b
bind '%' split-window -h -c '#{pane_current_path}'
bind '"' split-window -v -c '#{pane_current_path}'
bind c new-window -c '#{pane_current_path}'

Commands


Tmux has three levels of hierarchy when it comes to organizing views: sessions, windows, and panes. Sessions are groups of windows, and a window is a layout of panes.

Sessions…

tmux new -s htb // new session name 'htb'
tmux list-sessions // list sessions
tmux a // attach to last session
tmux a -t htb // attach to session name 'htb'

Windows…

prefix c // new window
prefix , // rename current window
prefix p // previos window
prefix n // next window
prefix & // close current window
prefix [0-9] //switch to window [0-9]

Panes…

prefix % // split pane horizontally
prefix " // split pane verifcally
prefix ! // convert pane to window
prefix [right/left/up/down] // move pane right/left/up/down (keep holding down prefix)
prefix [right/left/up/down] // switch to pane to the right/left/up/down (not holding down prefix)
prefix x // kill current pane