tmux

Installing

macOS

1
brew install tmux

Commands

tmux ls

1
tmux ls
  • returns list of active tmux sessions

Default key bindings

Default prefix key

1
ctrl(control) + b

Panes

default key bindings

Split the window horizontally (Horizontal pane)

1
ctrl(control) + b + "

Split the window vertically (Vertical pane)

1
ctrl(control) + b + %

Delete (kill) current (focused) pane

(with confirmation prompt)

1
ctrl(control) + b + x

Switch to the right pane

1
ctrl(control) + b + (right arrow)

Switch to the left pane

1
ctrl(control) + b + (left arrow)

Switch to the top pane

1
ctrl(control) + b + (up arrow)

Switch to the bottom pane

1
ctrl(control) + b + (down arrow)

Windows

Create and switch to new window

1
ctrl(control) + b + c

Switch to specific existing window

1
ctrl(control) + b + <window_number>

Switch to the next window

1
ctrl(control) + b + n

Switch to the previous window

1
ctrl(control) + b + p

Delete (kill) the current window

(with confirmation prompt)

1
ctrl(control) + b + &

Rename the current window

1
ctrl(control) + b + ,

Sessions

Create and attach to a new tmux session

(outside of tmux)

1
tmux

Create and attach to a new session with specific name

1
tmux new -s "session_name"

Disconnect the current tmux session

1
ctrl(control) + b + d

Back to last disconnected session

1
tmux attach

Show list of existing tmux sessions

1
tmux list-sessions

or

1
tmux ls

Attach to a specific tmux session

1
tmux attach -t <session_number|session_name>

or

1
tmux a -t <session_number|session_name>

Rename the current session

1
ctrl(control) + b + $

Show the list of tmux sessions, attach to or manage the session

Show the list

1
ctrl(control) + b + s
  • attach to selected session: Press the Enter
  • delete the selected session (with prompt): Press x

Configuring

Create configuration file

1
vim ~/.tmux.conf

Reload tmux to apply changes in config file

1
tmux source-file ~/.tmux.conf

In some cases you need to kill tmux process to apply changes in config file. Notice it will kill all tmux running sessions.

1
tmux kill-server

Subscribe to the newsletter

Get a once-per-week email with my latest content. By subscribing to this newsletter you will also be the first to receive last updates of my eBooks and courses.

0 members

Comments 💬