Each of us chooses for himself the most convenient development environment. Many use a separate IDE, several open consoles, a separate browser, and many other third-party tools. I adhere to the principle that everything should be multi-dimensional and simply configurable. Tmux allows you to make a very convenient working environment for the programmer.

Of course, even you need to get used to the good, it took me a couple of days to adapt to Tmux, after which I started changing the config to improve my performance. After six months, I do not imagine how you can work without it.
If you are interested in how you can change the usual console, turning it into something similar to the usual window manager, then welcome to the cat.
Why do you need it
Everything is good, you can conveniently work with a bunch of open windows, but ... if you work only on the local machine. And if you need to work remotely? For example, you need to interact in code with third-party software installed on a remote server, the functionality of which is not possible to emulate on a local machine. Or when there is just a terminal at hand, but there are no development tools and no rights to install them.
You can use the graphic terminals, forward the X-server. But the quality of the Internet connection cannot be guaranteed by anyone. And if earlier we struggled with dial-up modems, then today, having driven a little further downtown, we will fight with 3G modems. What can I say, and the wired Internet will not give a quiet job, if you do not take the channel more than 8 Mbitps, and for legal entities it is quite expensive.
')
Terminal Multiplexers
Working with Linux, we first open your favorite terminal, be it konsole, gnome-terminal, urxvt or something else. And everyone used to keep a bunch of tabs in this terminal for their purposes. But in an SSH session with a remote host, this is not possible. Of course, you can open a bunch of SSH connections on the local machine. And switching windows Putty, but it seems to me not very convenient. For one of these reasons, and invented terminal multiplexers.
The idea is simple - some kind of full-fledged terminal with tabs runs on a remote machine. Well, there are some additional features in the form of, for example, an internal clipboard.
Experienced system administrators have probably used the GNU Screen at least once. It is not very convenient in the mind of not quite intuitive settings. A newer solution is Tmux. It has more functionality, is easier to configure. About the use of this multiplexer and will be discussed.
Tmux features
Immediately provide an image that clearly shows what your console may look like when developing a Django project.

"
Fig.1 Tmux example for Django
Nice view. On one screen displays the "window" of IPython, a text editor and running a development server. And what's more interesting, you can reconfigure all key combinations for yourself.
And what is even more interesting, having left work where you were engaged in programming, from home you can again connect and restore your session with exactly the same open “windows” and all previous information will remain in them. Yes, console multiplexers save a session, for a certain combination, you can simply collapse it and then, if necessary, restore it. Consider that you simply did not minimize a separate window, but KDE as a whole. And since it is stored on the most remote machine, expanding it you will receive the entire same session from the house with which you worked, for example, on a trip.
The Tmux developer is said to have been greatly influenced by the awesome tile window manager. If someone is familiar with this shell, it will quickly flow.
Unlike the GNU Screen, the Tmux console multiplexer supports a large number of internal commands that can be used for hot combinations.
Tmux terminology has the following elements:
- window - a separate terminal, an analogue of a tab in a regular terminal (“window”);
- pane - a section of the console in a specific window (“cell”);
- status - status bar below.

Fig. 2 designation of the main elements of the Tmux window
Separate attention deserves the copy mode between the "windows" / "cells". Tmux supports two copy / paste modes - Vim or Emacs. I have a vim.
Suppose you need to select a piece of text and copy it to another terminal. Here is the solution to this problem:
- Press Escape- [, go to copy mode;
- We work with buttons j, k, l, m (it is also possible with arrows), we reach the necessary text;
- Space - began to choose. Also move the arrows in the text until the end of the desired text;
- Enter - the text is copied;
- Switch to another area ("window", "cell");
- Escape-] - text inserted
It looks harsh, but if you try to do a couple of times, everything becomes easy.
Adaptation
All console multiplexers are controlled according to the following principle: a certain escape character is pressed, followed by a certain sequence of characters responsible for some functionally. By default, in Tmux, the escape sequence is Ctrl-B (in GNU Screen Ctrl-A). Personally, I rewrote it on the `(reverse quote) character. It seemed to me convenient, given that I rather confidently use the text editor Vim.
Installed on Debian-like distributions like this:
apt-get install tmux$ HOME / .tmux.conf configuration file
Basic working shortcuts can be found at just a request on google
tmux keys . I have a few of them altered:
- `- escape key
- `-h - switch to the left pane
- `-j - switch to the bottom pane
- `-k - switch to the top pane
- `-l - switch to the right pane
- `-` - switch to the penultimate window
- `-a - insert the character` (backquote)
My tmux.conf can be found in applications.
Some attention should be paid to the colors in the terminal. The guide strongly recommends using the value of screen-256color or screen-256color-bce for the $ TERM environment variable inside Tmux. Outside Tmux, it is also better to use this value. I personally made alias in my
bashrc .
alias tmux = "TERM = screen-256color tmux"Applications
1. My tmux.confset-window-option -g mode-keys vi
set-option -g status-keys vi
set-window-option -g utf8 on
set-window-option -g mode-mouse off
set-option -g set-titles on
set-option -g set-titles-string '#S: # I. # P #W' # window number, program name, active (or not)
set-window-option -g automatic-rename on
set-window-option -g mode-bg magenta
set-window-option -g mode-fg black
set-option -g message-bg magenta
set-option -g message-fg black
set -g visual-activity off
set -g visual-bell off
set -g base-index 1
set-option -g status-utf8 on
set-option -g status-justify left
set-option -g status-bg black
set-option -g status-fg cyan
set-option -g status-interval 5
set-option -g status-right-length 30
set-option -g status-right '# [fg = magenta] "# [fg = blue, bold] # T # [default]'
# set-option -g status-left '# [fg = cyan] "" # [fg = blue, bold] ### S # [fg = magenta]% R% m-% d # (acpi | cut-d' , '-f 2) # [default]'
# set-option -g status-left '# [fg = cyan] "" # [fg = blue, bold] ### S # [fg = magenta]% R% m-% d # (acpi | cut-d' , '-f 2) # [default]'
set-option -g visual-activity on
set-window-option -g monitor-activity on
set-window-option -g window-status-current-fg colour154
set-window-option -g window-status-fg colour243
set-window-option -g clock-mode-color cyan
set-window-option -g clock-mode-style 24
set -g terminal-overrides 'xterm *: smcup @: rmcup @'
set -s escape-time 1
set -g default-terminal "screen-256color"
set -g prefix `
bind `send-prefix
bind-key `last-window
unbind%
unbind ""
unbind x
unbind Co
unbind k
unbind j
unbind h
unbind l
bind-key H split-window -h
bind-key V split-window -v
bind-key a send-keys `
bind-key X kill-pane
bind-key K confirm-before kill-window
bind-key N rotate-window -U
bind-key P rotate-window -D
bind-key j select-pane -D
bind-key k select-pane -U
bind-key h select-pane -L
bind-key l select-pane -R
bind-key F swap-pane -U
bind-key D swap-pane -D
2.My screenrcstartup_message off
defmonitor on
defscrollback 10240
autodetach on
vbell off
termcapinfo xterm | xterms | xs | rxvt ti @: te @
escape `e
altscreen on
autodetach on
caption always "% {= 45}% {+ bw} Screen:% n |% h% =% t% c"
#hardstatus alwayslastline "% -Lw% {= BW}% 50>% n% f *% t% {-}% + Lw% <"
alwayslastline hardstatus
hardstatus string '% {= kG}% {= kw}%?% - Lw%?% {r} (% {W}% n *% f% t%? (% u)%?% {r})% {w}%?% + Lw%?%?% =% {g} '
Some introductory links
1.
Official man tmux ;
2.
Tmux on the wiki ;
3.
GNU Screen on the wiki .