Tmux

by msypniewski511 in Linux

Using tmux

Running tmux

$ tmux

Naming the session

$ tmux rename-session tutorial

Creating another window
Ctrl + b, then c
Jump into last window
Ctrl +b, then l
Jump to next window
Ctrl + b, then n
Choose window interface
** Ctrl + b, then w**
The prefix key: Ctrl + b = Prefix
Switch to previous window
Prefix, p
Switch to next window
Prefix, n
Search for text in windows
Prefix, f
Detaching and attaching
Prefix, d
View the active sessions

$ tmux list-sessions

Reattach the detached session

$ tmux attach-session -t session-name

Renaming windows
Prefix, ,
Kiling windows
Prefix, &

Help on key bindings
Prefix, ?
Search down:
Ctrl + s and /

Configuration tmux

Web

set-option

This command can be called on its own to set an option temporarily. However, most
of the time, we will use it to set options within a tmux configuration file so each time
we launch tmux, the options are set the way we would like.

$ tmux set-option status off

Creating a tmux configuration file

$ cd ~
$ touch .tmux.conf

Starting point

tmux show -g | sed 's/^/set -g /' > ~/.tmux.conf

Show options

$ tmux show-options
$ tmux show-options -g

To set key modes add the following couple line to .tmux.conf

set-option -g status-keys emacs
set-option -g mode-keys emacs

Enabling mouse mode

.tmux.conf

set-window-option -g mouse-mode on
set-option -g mouse-select-window on
set-option -g mouse-select-pane on
set-option -g mouse-resize-pane on

Now is enough:

set -g mouse on

Changing the status bar

set -g status-style fg=black,bg=blue
set-window-option -g window-status-current-style bg=#FF0000

Reloading the configuration

$ tmux source-file ~/.tmux.conf

Sessions, Windows, and Panes

Sessions are essentially the base unit in tmux. It can have one or more windows, and
a window can be broken into one or more panes.
Creating sessions

$ tmux new-session -s name

Prefix, d

$ tmux new-session -s second_name

Switch session

Prefix, s
Prefix, )

Multiple panels

Split the window vertically

Prefix, %
Split the window horizontally
Prefix, "

Moving between panes

Prefix, o
Prefix, arrows

Kill pane

Prefix, x

Zooming panes

Prefix, z

Resizing panes

Prefix key followed by the arrow keys to move on to the next one until all panes

0 Replies


Leave a replay

To replay you need to login. Don't have an account? Sign up for one.