TMux: Difference between revisions
Jump to navigation
Jump to search
Line 18: | Line 18: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
''' | '''session:''' | ||
─────────────────────────────────────────────── | ─────────────────────────────────────────────── | ||
'''Ctrl + a''' → | '''Ctrl + a''' → w » Session and Window Preview | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ( » Move to previous session | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ) » Move to next session | ||
'''Ctrl + a''' → | '''Ctrl + a''' → d » Detach from session | ||
'''Ctrl + a''' → | '''Ctrl + a''' → s » Show all sessions | ||
'''Ctrl + a''' → | '''Ctrl + a''' → $ » Rename session | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
| valign="top" | | | valign="top" | | ||
Line 46: | Line 46: | ||
|- | |- | ||
| valign="top" | | | valign="top" | | ||
''' | '''pane:''' | ||
─────────────────────────────────────────────── | ─────────────────────────────────────────────── | ||
'''Ctrl + a''' → | '''Ctrl + a''' → - » Split pane horizontally | ||
'''Ctrl + a''' → | '''Ctrl + a''' → | » Split pane vertically | ||
'''Ctrl + a''' → | '''Ctrl + a''' → x » Close active pane | ||
'''Ctrl + a''' → | '''Ctrl + a''' → q » Show pane numbers | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → ʘ » | |||
'''Ctrl + a''' → ʘ » | |||
| valign="top" | | | valign="top" | | ||
''' | '''pane:''' | ||
─────────────────────────────────────────────── | ─────────────────────────────────────────────── | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
'''Ctrl + a''' → | '''Ctrl + a''' → ʘ » | ||
|} | |} |
Revision as of 23:30, 17 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.
Cheat Sheet
misc: ─────────────────────────────────────────────── Ctrl + a → : » Enter command mode |
misc: ─────────────────────────────────────────────── Ctrl + a → ? » List key bindings |
| |
session: ─────────────────────────────────────────────── Ctrl + a → w » Session and Window Preview Ctrl + a → ( » Move to previous session Ctrl + a → ) » Move to next session Ctrl + a → d » Detach from session Ctrl + a → s » Show all sessions Ctrl + a → $ » Rename session Ctrl + a → ʘ » Ctrl + a → ʘ » |
window: ─────────────────────────────────────────────── Ctrl + a → n » Next window Ctrl + a → w » List windows Ctrl + a → p » Previous window Ctrl + a → c » Create a new window Ctrl + a → & » Close active window Ctrl + a → , » Rename active window Ctrl + a → 1 » Toggle last active window Ctrl + a → 0…9 » Switch to window by number |
| |
pane: ─────────────────────────────────────────────── Ctrl + a → - » Split pane horizontally Ctrl + a → | » Split pane vertically Ctrl + a → x » Close active pane Ctrl + a → q » Show pane numbers Ctrl + a → ʘ » Ctrl + a → ʘ » Ctrl + a → ʘ » Ctrl + a → ʘ » |
pane: ─────────────────────────────────────────────── Ctrl + a → ʘ » Ctrl + a → ʘ » Ctrl + a → ʘ » Ctrl + a → ʘ » Ctrl + a → ʘ » Ctrl + a → ʘ » |
Installation
sudo apt install tmux
sudo apt install powerline
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
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
# window/pane split
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# list of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
# initialize tmux plugin manager
run '~/.tmux/plugins/tpm/tpm'
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 ls tmux kill-server tmux list-sessions tmux kill-session -a tmux kill-session -t {index} pkill -f tmux ps aux | grep tmux |
| ||
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
| ||
| ||
python3 -m site --user-site python3 -m site | grep packages python3 -m sysconfig | grep packages |
windows 11 C:\> py -c "import sysconfig; print(sysconfig.get_path('purelib'))" python3 -c "import sysconfig; print(sysconfig.get_path('purelib'))" | |
| ||
python3 -m venv ~/.venv/powerline --prompt="Powerline"
# source .venv/bin/activate
# (Powerline) $
| ||
| ||
python -m venv ~/.venv/powerline --prompt="Powerline"
# .venv\Scripts\activate
# (Powerline) PS>
| ||
| ||
uptime | cut -f 4-5 -d ' ' | cut -f 1 -d ',' |
References
| ||