Linux Terminal Multi-window tool Tmux compilation and installation

Source: Internet
Author: User
Tags sessions git clone

Tmux (full name is Terminal multiplexer) is an excellent end-use software, similar to GNU screen, but from OpenBSD, with BSD licensing. The most intuitive benefit of using it is that when you log in to a remote host through a terminal and run Tmux, you can open multiple consoles in it without having to "waste" redundant terminals to connect to the remote host, which is much more than that. Advantages over screen: You can split the windows horizontally and vertically, and the panes are free to move and resize. can be copied and pasted in multiple buffers, support cross-window search; no need to re-detach after normal disconnection; Some people say that--screen is almost tmux compared to the other one.


SOURCE Download:

# wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz# git clone https://github.com/ Thomasadam/tmux.git


Compile and install:

# sh autogen.sh # TAR-XVF libevent-2.0.21-stable.tar.gz# cd libevent-2.0.21-stable #./configure # make && make I  Nstall # du-smh tmux21mtmux# sh autogen.sh # cflags= "-i/usr/local/include" ldflags= "-l//usr/local/lib"./configure# make && make Install



Tmux using keyboard, common shortcut keys include:

Ctrl+b Activates the console, at which point the following keys take effect








System operation

?
List all shortcut keys, press Q to return
D Out of the current session so that you can temporarily return to the Shell interface and enter Tmux attach to re-enter the previous session
D Select the session to detach from and use when multiple sessions are open at the same time
CTRL + Z Suspend current session
R Force redraw of non-detached sessions
S Select and switch sessions, use when multiple sessions are open at the same time
: Enter command-line mode, at which point you can enter supported commands, such as Kill-server to shut down the server
[ Enter copy mode; At this point the operation is the same as Vi/emacs, press Q/esc to exit
~ Lists the cue information cache, which contains the various prompts that were previously returned by Tmux
Window operations C Create a new window
& Close the current window
Data key Switch to the specified window
P switch to the first window
N Switch to the next window
L Switch between the front and back two windows
W Switch Windows by window list
, Renames the current window so that it is easy to identify
. Modify the current window number; the equivalent of a window reordering
F Finds the specified text in all Windows
Panel operation

"

Divides the current panel into two upper and lower blocks
% Divide the current panel between the left and right two blocks
X Close the current panel
! Places the current panel in a new window, or creates a new window that contains only the current panel
CTRL + ARROW keys Moves the edge in 1 cells to adjust the current panel size
Alt + arrow keys Moves the edge in 5 cells to adjust the current panel size
Space Cycle through preset panel layouts, including Even-horizontal, Even-vertical, Main-horizontal, main-vertical, tiled
Q Display Panel number
O Select the next panel in the current window
Direction key Move the cursor to select a panel
{ Forward Displacement Current panel
} Replace the current panel backwards
Alt+o Rotate the panel of the current window counterclockwise
Ctrl+o Rotate the panel of the current window clockwise

tmux configuration
Tmux has a system-level configuration file of/etc/tmux.conf and a user-level profile of ~/.tmux.conf. A configuration file is actually a collection of commands for Tmux, which means that each line of configuration can be entered into effect after entering command-line mode.
The following is an example of a ~/.tmux.conf, which includes some common configurations:

#此类配置可以在命令行模式中输入show-options -g Query set-option -g base-index 1                           #窗口的初始序号; default is 0, this is set to 1set-option -g display-time 5000                     #提示信息的持续时间; Set enough time to avoid seeing the hints, Units are in milliseconds set-option -g repeat-time 1000                      #控制台激活后的持续时间, set the appropriate time to avoid activating the console for each operation. Units are in milliseconds set-option -g status-keys vi                        #操作状态栏时的默认键盘布局; can be set to VI or emacsset-option  -g status-right  "# (date +%h:%m '   ')"      #状态栏右方的内容; the settings here will get something like 23 : 59 Display Set-option -g status-right-length 10              # The content length to the right of the status bar; it is recommended to leave more space to the left of the status bar (for listing the current window) set-option -g status-utf8 on                        Turn on the status bar for UTF-8 support   #此类设置可以在命令行模式中输入show-window-options -g query set-window-option -g mode-keys  vi     #复制模式中的默认键盘布局; can be set to VI or emacsset-window-option -g utf8 on           #开启窗口的UTF-8 support   #将激活控制台的快捷键由Ctrl +b modified to Ctrl+aset-option -g  prefix C-aunbind-key C-bbind-key C-a send-prefix  #添加自定义快捷键bind-key z  kill-session                       #按z结束当前会话, equivalent to entering command line mode after entering kill-sessionbind-key h select-layout  even-horizontal    #按h将当前面板布局切换为even-horizontal, equivalent to entering command line mode after entering Select-layout even-horizontalbind-key v select-layout  even-vertical       #按v将当前面板布局切换为even-vertical, equivalent to entering command line mode after entering Select-layout  even-vertical1


Tmux Common commands:

tmux                               #开启tmuxtmux  ls                             #列出会话 (tmux list-session ) tmux attach                       # Tmux reconnect to the previous window to use tmux attach -t session             #进入某个会话tmux  -r                            #连接上次断开的sessiontmux   kill-session                # Close last Tmux open window tmux kill-server                 # Close all Tmux open windows

Reference:

http://josephj.com/entry.php?id=373

Http://blog.linuxeye.com/323.html

This article from "Attention to Linux Technology" blog, reproduced please contact the author!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.