tmux
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
tmux [2021/03/10 20:15] – [.tmux.conf] hc9 | tmux [2022/12/05 06:18] – hc9 | ||
---|---|---|---|
Line 5: | Line 5: | ||
A newer alternative to the classic [[http:// | A newer alternative to the classic [[http:// | ||
- | A Tmux command is usually of the form CTRL-b KEY, i.e., you'll have to press the CTRL key along with b, followed by a generic KEY. This initial part of a command is called prefix, and can be configured. | + | A Tmux command is usually of the form **CTRL-b KEY**, i.e., you'll have to press the **CTRL** key along with b, followed by a generic KEY. This initial part of a command is called prefix, and can be configured. |
You'll need to be a [[http:// | You'll need to be a [[http:// | ||
Line 19: | Line 19: | ||
'' | '' | ||
- | In your terminal a status bar will show up, with the name of your shell in the bottom left (actually, the name of the terminal window you're on), and a clock in the bottom right. There are many customizations possible for this status bar, you can check the documentation for all available options. To detach from a session, type CTRL-b d, and you will return to a normal promopt. Tmux will keep your session alive, and to resume it run: | + | In your terminal a status bar will show up, with the name of your shell in the bottom left (actually, the name of the terminal window you're on), and a clock in the bottom right. There are many customizations possible for this status bar, you can check the documentation for all available options. To detach from a session, type **CTRL-b d**, and you will return to a normal promopt. Tmux will keep your session alive, and to resume it run: |
'' | '' | ||
Line 25: | Line 25: | ||
===== Multiple windows ===== | ===== Multiple windows ===== | ||
- | By default, a Tmux session starts with only one window. You can create more by typing CTRL-b c. All windows have a numeric id, and start named as the current shell or command being run. To rename the current window, type CTRL-b ,. Then you can switch between windows typing CTRL-b number, where number is the number of a window. CTRL-b n and CTRL-b p are both shortcuts to, respectively, | + | By default, a Tmux session starts with only one window. You can create more by typing |
===== Multiple sessions ===== | ===== Multiple sessions ===== | ||
Line 37: | Line 37: | ||
'' | '' | ||
- | It is possible to split windows in a session with CTRL-b " or CTRL-b %, respectively, | + | It is possible to split windows in a session with **CTRL-b "** or **CTRL-b %**, respectively, |
===== Sharing screen sessions ===== | ===== Sharing screen sessions ===== | ||
Line 57: | Line 57: | ||
Tmux is configured by a file located at $HOME/ | Tmux is configured by a file located at $HOME/ | ||
- | <code> | + | <file config $HOME/ |
# makes window' | # makes window' | ||
set -g base-index 1 | set -g base-index 1 | ||
Line 72: | Line 73: | ||
# set default terminal | # set default terminal | ||
set -g default-terminal " | set -g default-terminal " | ||
- | </code> | + | |
+ | </file> | ||
===== Reset Lost Sessions ===== | ===== Reset Lost Sessions ===== | ||
Line 80: | Line 83: | ||
'' | '' | ||
+ | |||
+ | ===== Emulating Emacs-like registers ===== | ||
+ | |||
+ | If you have a need for multiple clipboard-like buffers for storing and retrieving text (akin to registers in Emacs or Vim), Tmux already supports that, although this functionality is not well exposed by default. Below is a sample piece of configuration that makes available 26 registers designated by single lower-case letters //a-z//. | ||
+ | |||
+ | < | ||
+ | |||
+ | # Initialize alphanumerical registers to avoid the problem with ' | ||
+ | run "tmux set-buffer -b a \" | ||
+ | run "tmux set-buffer -b b \" | ||
+ | run "tmux set-buffer -b c \" | ||
+ | run "tmux set-buffer -b d \" | ||
+ | run "tmux set-buffer -b e \" | ||
+ | run "tmux set-buffer -b f \" | ||
+ | run "tmux set-buffer -b g \" | ||
+ | run "tmux set-buffer -b h \" | ||
+ | run "tmux set-buffer -b i \" | ||
+ | run "tmux set-buffer -b j \" | ||
+ | run "tmux set-buffer -b k \" | ||
+ | run "tmux set-buffer -b l \" | ||
+ | run "tmux set-buffer -b m \" | ||
+ | run "tmux set-buffer -b n \" | ||
+ | run "tmux set-buffer -b o \" | ||
+ | run "tmux set-buffer -b p \" | ||
+ | run "tmux set-buffer -b q \" | ||
+ | run "tmux set-buffer -b r \" | ||
+ | run "tmux set-buffer -b s \" | ||
+ | run "tmux set-buffer -b t \" | ||
+ | run "tmux set-buffer -b u \" | ||
+ | run "tmux set-buffer -b v \" | ||
+ | run "tmux set-buffer -b w \" | ||
+ | run "tmux set-buffer -b x \" | ||
+ | run "tmux set-buffer -b y \" | ||
+ | run "tmux set-buffer -b z \" | ||
+ | | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | # Copy to user-selected register | ||
+ | bind -T copy-mode r command-prompt -1 -p ' | ||
+ | # Paste from user-selected register | ||
+ | bind -T prefix C-] command-prompt -1 -p ' | ||
+ | | ||
+ | </ | ||
+ | |||
+ | The way it works is this: when in // | ||
+ | |||
+ | ===== Troubleshooting Colors ===== | ||
+ | |||
+ | If colors are not working in your tmux session try running tmux with the -2 flag. | ||
+ | |||
+ | '' | ||
+ | |||
+ | To persist 256color support in your terminal you can add the following line to your ~/.bashrc | ||
+ | |||
+ | '' | ||
===== Resources ===== | ===== Resources ===== | ||
Line 87: | Line 147: | ||
* [[https:// | * [[https:// | ||
* [[http:// | * [[http:// | ||
- | * [[http:// | + | * [[wp>Tmux|http:// |
---- | ---- | ||
- | $Id: tmux.html,v 1.6 2014/06/09 06:08:42 ike Exp $ [[http:// | + | $Id: tmux.html,v 1.6 2014/06/09 06:08:42 ike Exp $ [[http:// |
tmux.txt · Last modified: 2022/12/05 06:18 by hc9