TMux

From Chorke Wiki
Revision as of 08:39, 15 February 2023 by Shahed (talk | contribs) (Created page with "<code>tmux</code> is an open-source terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

tmux is an open-source terminal multiplexer for Unix-like operating systems. It allows multiple terminal sessions to be accessed simultaneously in a single window. It is useful for running more than one command-line program at the same time.

Install

sudo apt install tmux

cat << EOF | tee ${HOME}/.tmux.conf >/dev/null
set -g base-index 1
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

set -g default-terminal 'screen-256color'
set -g history-limit 10000
set -g status-fg  green
set -g status-bg  black

# Window/pane split
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
EOF

Knowledge

tmux ls
tmux new -s my_session
tmux attach-session -t 0
tmux attach-session -t my_session

Ctrl + b % » Split pane horizontally
Ctrl + b " » Split pane vertically
Ctrl + b x » Close current pane
Ctrl + b c » Create a new window
Ctrl + b w » Choose window from a list
Ctrl + b 0 » Switch to window by number
Ctrl + b , » Rename the current window

Ctrl + b o » Go to the next pane
Ctrl + b ; » Toggle between pane
Ctrl + b d » Detach the session

References