TMux: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 28: Line 28:
==Knowledge==
==Knowledge==
{|
{|
| valign="top" |
|valign="top"|
  tmux ls
  tmux ls
  tmux new -s my_session
  tmux new -s my_session
Line 38: Line 38:
  '''Ctrl + a''' x » Close current pane
  '''Ctrl + a''' x » Close current pane


| valign="top" |
|valign="top"|
  '''Ctrl + a''' c » Create a new window
  '''Ctrl + a''' c » Create a new window
  '''Ctrl + a''' w » Choose window from a list
  '''Ctrl + a''' w » Choose window from a list
Line 48: Line 48:
  '''Ctrl + a''' d » Detach the session
  '''Ctrl + a''' d » Detach the session


| valign="top" |
|valign="top"|


|-
|-
| colspan="3" |
|colspan="3"|
----
----
|-
|-
| valign="top" |
|valign="top" colspan="2"|
<source lang='bash'>
TMUX_INSTALL_STATUS="$(dpkg-query -W --showformat='${db:Status-Status}' 'tmux' 2>&1)"
if [[ ! $? -eq 0 ]]||[[ ! "${TMUX_INSTALL_STATUS}" -eq 'installed' ]];then
    printf 'tmux \033[0;31mnot found! \033[0m:(\n';exit 1
fi


| valign="top" |
POWERLINE_INSTALL_STATUS="$(dpkg-query -W --showformat='${db:Status-Status}' 'powerline' 2>&1)"
if [[ ! $? -eq 0 ]]||[[ ! "${POWERLINE_INSTALL_STATUS}" -eq 'installed' ]];then
    printf 'powerline \033[0;31mnot found! \033[0m:(\n';exit 1
fi
</source>


| valign="top" |
|valign="top"|


|}
|}

Revision as of 10:29, 15 February 2023

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
sudo apt install powerline

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 + a % » Split pane horizontally
Ctrl + a " » Split pane vertically
Ctrl + a x » Close current pane
Ctrl + a c » Create a new window
Ctrl + a w » Choose window from a list
Ctrl + a 0 » Switch to window by number
Ctrl + a , » Rename the current window

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

TMUX_INSTALL_STATUS="$(dpkg-query -W --showformat='${db:Status-Status}' 'tmux' 2>&1)"
if [[ ! $? -eq 0 ]]||[[ ! "${TMUX_INSTALL_STATUS}" -eq 'installed' ]];then
    printf 'tmux \033[0;31mnot found! \033[0m:(\n';exit 1
fi

POWERLINE_INSTALL_STATUS="$(dpkg-query -W --showformat='${db:Status-Status}' 'powerline' 2>&1)"
if [[ ! $? -eq 0 ]]||[[ ! "${POWERLINE_INSTALL_STATUS}" -eq 'installed' ]];then
    printf 'powerline \033[0;31mnot found! \033[0m:(\n';exit 1
fi

References