Differences
This shows you the differences between two versions of the page.
linux_wiki:tmux [2015/10/16 09:20] billdozor |
linux_wiki:tmux [2019/05/25 23:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Tmux ====== | ||
- | **General Information** | ||
- | |||
- | Tmux is a terminal multiplexer. It is basically screen with more advanced features. | ||
- | |||
- | **Checklist** | ||
- | * Distros: All | ||
- | * Package: tmux | ||
- | |||
- | ---- | ||
- | |||
- | ====== Install ====== | ||
- | |||
- | Install tmux: | ||
- | <code bash> | ||
- | yum install tmux | ||
- | or | ||
- | apt-get install tmux | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Tmux Operation ====== | ||
- | |||
- | 1) Open a terminal | ||
- | |||
- | 2) Start a tmux session (default name) | ||
- | <code bash> | ||
- | tmux | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Session Control ===== | ||
- | |||
- | Start a named tmux session | ||
- | <code bash> | ||
- | tmux new -s MySession | ||
- | </ | ||
- | |||
- | Detach from open session | ||
- | <code bash> | ||
- | Ctrl+b d | ||
- | </ | ||
- | |||
- | List tmux sessions | ||
- | <code bash> | ||
- | tmux list-sessions | ||
- | </ | ||
- | |||
- | Attach to session | ||
- | <code bash> | ||
- | tmux attach -t MySession | ||
- | </ | ||
- | |||
- | Rename existing session | ||
- | <code bash> | ||
- | Ctrl+b : | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Windows ===== | ||
- | |||
- | Like screen, tmux has windows. | ||
- | |||
- | Create a new window | ||
- | <code bash> | ||
- | Ctrl+b c | ||
- | </ | ||
- | |||
- | Next Window | ||
- | <code bash> | ||
- | Ctrl+b n | ||
- | </ | ||
- | |||
- | Previous Window | ||
- | <code bash> | ||
- | Ctrl+b p | ||
- | </ | ||
- | |||
- | Rename Window | ||
- | <code bash> | ||
- | Ctrl+b , | ||
- | MyWindow | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Panes ===== | ||
- | |||
- | An advantage that tmux has over screen, is the ability to create panes. | ||
- | |||
- | Split window horizontally | ||
- | <code bash> | ||
- | Ctrl+b " | ||
- | </ | ||
- | |||
- | Split window vertically | ||
- | <code bash> | ||
- | Ctrl+b % | ||
- | </ | ||
- | |||
- | Kill current pane | ||
- | <code bash> | ||
- | Ctrl+b x | ||
- | OR | ||
- | exit | ||
- | </ | ||
- | |||
- | Navigate between panes | ||
- | <code bash> | ||
- | Ctrl+b up/ | ||
- | </ | ||
- | |||
- | Maximize current pane (other pane moves to its own window) | ||
- | <code bash> | ||
- | Ctrl+b ! | ||
- | </ | ||
- | |||
- | Auto-resize panes to equal space horizontally | ||
- | <code bash> | ||
- | Ctrl+b ESC+2 | ||
- | </ | ||
- | |||
- | Auto-resize panes to equal space vertically | ||
- | <code bash> | ||
- | Ctrl+b ESC+1 | ||
- | </ | ||
- | ---- | ||
- | |||
- | ===== Copy/Paste with Keyboard ===== | ||
- | |||
- | Enter copy mode | ||
- | <code bash> | ||
- | Ctrl+b [ | ||
- | </ | ||
- | |||
- | **While in copy mode** | ||
- | |||
- | * Move around: arrow keys | ||
- | * Start selection: space | ||
- | * Copy selection: enter | ||
- | |||
- | Paste selection | ||
- | <code bash> | ||
- | Ctrl+b ] | ||
- | </ | ||
- | |||
- | ===== Other Commands ===== | ||
- | |||
- | Help | ||
- | <code bash> | ||
- | Ctrl+b ? | ||
- | </ | ||
- | |||
- | List Commands | ||
- | <code bash> | ||
- | Ctrl+b : | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Tmux Config File ====== | ||
- | |||
- | You can customize tmux with a config file in your home directory. | ||
- | |||
- | The following is a running list of customizations I find useful. | ||
- | |||
- | ~/ | ||
- | <code bash> | ||
- | # use the vim motion keys to move between panes | ||
- | bind-key h select-pane -L | ||
- | bind-key j select-pane -D | ||
- | bind-key k select-pane -U | ||
- | bind-key l select-pane -R | ||
- | |||
- | # set history scroll back size (default is 2000, also set terminal scroll back to be >= ) | ||
- | set-option -g history-limit 5000 | ||
- | |||
- | # start window index at 1 instead of 0 | ||
- | set -g base-index 1 | ||
- | |||
- | # Allow xterm titles in terminal window, terminal scrolling with scrollbar, and setting overrides of C-Up, C-Down, C-Left, C-Right | ||
- | set -g terminal-overrides " | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ====== Tmux Aliases ====== | ||
- | |||
- | Some useful tmux aliases from ~/.bashrc | ||
- | <code bash> | ||
- | # Tmux Aliases | ||
- | alias tls=' | ||
- | alias tat=' | ||
- | alias tns=' | ||
- | </ | ||
- | |||
- | ---- |