Original address: http://kumu-linux.github.io/blog/2013/08/06/tmux/
"The gentleman born is not dissimilar also, the good leave in the thing also". -The word "Xunzi Quanxue"
If you remember correctly, "Xun Zi Quanxue" We should have read this article in our generation High school. The original intention is probably a gentleman's qualifications and the General people no difference, the gentleman is higher than the average person, because he can be good at using foreign objects. For technical people, the choice of good tools and use can often save a lot of unnecessary trouble, good open source tools a lot, see how you use. The use of Tmux for terminal reuse tools is recommended here, of course, this kind of tool is also better with screen, but relative to screen here I prefer to recommend tmux[and so on.
If it's just a multiple-label feature, then Putty can do it with some tools, or simply use Xshell, and of course tmux such tools is not just that simple. Another reason to choose to use the Tmux/screen tool is that sometimes we often need ssh or telent telnet to a Linux server, and some tasks need to run for a long time, such as system backup, data transmission, etc. Usually we are open a remote terminal window, because the execution time is relatively long, generally need to wait for it to perform, in this process can not close the window or network reasons disconnected, disconnect after game over. This functionality is somewhat similar to the implementation of the Nohup and Setsid commands, while Tmux/screen sets Nohup/setsid and multiple tags in one. With less nonsense, we'll see how to install it. installation
Install the words here is to explain, different Linux distribution corresponding package management mechanism is different, install Tmux package can. Use Tips several nouns
Tmux mainly includes the following modules:
Session |
Session: A server can contain multiple sessions |
Window |
Windows: A session can contain multiple windows |
Pane |
Panel: A window can contain multiple panels [powerful split screen] |
A small test of a sledgehammer
After listing a few basic modules of tmux, it is necessary to have some real dry goods, and screen by default to activate the console Ctrl + A, tmux default is ctrl+b, use shortcut keys can be followed by some corresponding instructions. Of course, if you are not accustomed to using ctrl+b, you can also add the following in the ~/.tmux file to Ctrl + A:
# Set prefix key to ctrl-a
unbind-key c-b
set-option-g prefix c-a
|
All of the following operations are activated after the console, that is, to type the ctrl+b premise before you can use the command "here to assume that the shortcut key has not changed, then use Ctrl+b."
Basic operations:
? |
Lists all shortcut keys, and press Q to return |
D |
Out of the current session, you can return to the Shell interface temporarily, enter TMUX attach can re-enter the previous session |
S |
Select and switch sessions, and use when multiple sessions are opened simultaneously |
D |
Select the session you want to detach from, and use when multiple sessions are opened simultaneously |
: |
Enter command line mode, at which point you can enter supported commands, such as kill-server all Tmux sessions |
[ |
Copy mode, the cursor moved to the Copy content location, the space bar began, the key to select replication, carriage return confirmation, Q/ESC exit |
] |
Go to paste mode, paste the copied content, press Q/esc to exit |
~ |
Lists the hint information cache, which contains information about the various prompts that were returned before Tmux |
T |
Displays the current time |
Ctrl+z |
Suspend current session |
Window actions:
C |
Create a new window |
& |
Close the current window |
Number keys |
Switch to the specified window |
P |
Switch to the first window |
N |
Switch to the next window |
L |
Switch between front and rear windows |
W |
Switch Windows by window list |
, |
Renames the current window for easy identification |
. |
Modifies the current window number, which is equivalent to reordering |
F |
Find keywords in all windows to make it easier to switch windows |
Panel action:
" |
" split the current panel up and down " |
% |
split the current panel right and left" |
x |
to close the current split screen |
! | The
places the current panel in a new window, new window containing only the current panel |
Ctrl + Direction key |
moves the edge in 1 cells to adjust the current panel size |
ALT + Direction key |
moves the edge in 5 cells to adjust the current panel size |
The
space bar |
can be toggled in the default panel layout, so try to find out. |
q |
display panel number |
o |
Select the next panel in the current window |
Direction key |