The gMan nixWiki

Because the mind is made of Teflon...

User Tools

Site Tools


cheat_sheets_tmux

tmux

Sessions

A session is a group of windows (and each window has at least one pane).

Commands:

# New Session
tmux
tmux new -s [session name]

# Sessions Management
tmux ls  # lists current running sessions
tmux rename-session -t [number] [new name]

# Attach Session
tmux a -t [session name or number]

# Remove Session
tmux kill-ses
tmux kill-session -t [name]

Key Bindings:

Command Description
Ctrl-b $ rename session
Ctrl-b d detach session
Ctrl-b D detach session, choice
Ctrl-b ) next session
Ctrl-b ( previous session

Windows

Windows are like tabs in a browser. Windows exist in sessions and occupy the whole screen.

Key Bindings:

Command Description
Ctrl-b c create window
Ctrl-b n move to next window
Ctrl-b p move to previous window
Ctrl-b l move to last window used
Ctrl-b 0-9 select window by number
Ctrl-b ' select window by name
Ctrl-b . change window number
Ctrl-b , change window name
Ctrl-b f find window (search)
Ctrl-b & kill window

Panes

Panes are sections of windows that have been split vertically or horizontally (like… uh… panes in a glass window…)

Key Bindings:

Command Description
Ctrl-b % split vertical
Ctrl-b “ split horizontal
Ctrl-b [right arrow] move to pane to the right
Ctrl-b [left arrow] move to pane to the left
Ctrl-b [up arrow] move to pane above
Ctrl-b [down arrow] move to pane below
Ctrl-b o go to next pane
Ctrl-b ; got to last active pane
Ctrl-b } rotate panes clockwise
Ctrl-b { rotate panes counter-clockwise
Ctrl-b ! convert pane to window
Ctrl-b x kill pane

Copy

Resource: Everything you need to know about tmux copy

To copy outside tmux: You should be able to highlight with your mouse (shift + left-mouse-button). Once highlighted, go to the program where you want to paste and click the middle-mouse-button.

  • If that doesn't work (sometimes it does… sometimes it doesn't… and that drives me nuts!)…
  • Shift + Left-Mouse-Button: This highlights the text you want to copy. Then just go to the window/program into which you want to paste and middle-mouse-button to paste (i.e., Linux default behavior).

To copy inside tmux: See the following…

Key Bindings:

Command Description
Ctrl-b [ enter copy mode
Ctrl-b ] paste from buffer

Copy Mode Commands:

Command Description
Ctrl-[spacebar] start selection
Ctrl-w or Alt-w copy selection
Ctrl-[Esc] clear selection
Ctrl-g go to top
Ctrl-G go to bottom
Ctrl-h move cursor left
Ctrl-j move cursor down
Ctrl-k move cursor up
Ctrl-l move cursor right
Ctrl-/ search
Ctrl-# list paste buffers
Ctrl-q quit

Other Stuff

Mouse Mode

Mouse mode allows you to control the pane selection, pane resizing, window selection operation, along with scrolling, with the mouse.

To enable the mouse mode, open the ~/.tmux.conf file and put the following line inside it:

setw -g mouse on

Reload it (whenever you change a configuration file of a running program, like a Bash shell, etc., you need to source it to load it again–or exit and enter again):

tmux source-file ~/.tmux.conf

cheat_sheets_tmux.txt · Last modified: 2024/01/20 16:28 by gman