tmux
Tmux is an excellent terminal reuse software, similar to GNU Screen, but comes from OpenBSD and is licensed by BSD.
Supplementary instructions
The most intuitive benefit of using it is that after logging in to the remote host through a terminal and running tmux, you can open multiple consoles without "wasting" extra terminals to connect to the remote host;
Function
Install
brew install tmux
sudo apt-get install tmux
yum install -y tmux
yum install libevent libevent-devel ncurses-devel
tar -zvxf tmux-2.3.tar.gz
cd tmux-2.3
./configure
make && make install
Instructions for using shortcut keys
| | Ctrl+b | Activate the console; the following keys take effect at this time |
System operation
| | ? | List all shortcut keys; press q to return |
d | Detach from the current session; this allows you to temporarily return to the Shell interface and enter tmux attach to re-enter the previous session |
D | Select the session to leave; use it when multiple sessions are open at the same time |
Ctrl+z | Suspend current session |
r | Force redraw of undetached sessions |
s | Select and switch sessions; used when multiple sessions are open at the same time |
: | Enter command line mode; you can enter supported commands at this time, such as kill-server to shut down the server |
[ | Enter copy mode; the operation at this time is the same as vi/emacs, press q/Esc to exit |
~ | List the prompt information cache; it contains various prompt information previously returned by tmux |
Window operations
| | c | Create new window |
& | Close current window |
Numeric keys | Switch to the specified window |
p | Switch to the previous window |
n | Switch to next window |
l | Switch between the front and rear windows |
w | Switch windows via window list |
, | Rename the current window; this makes it easier to identify |
. | Modify the current window number; equivalent to window reordering |
f | Find the specified text in all windows |
Panel operation
| | ” | Divide the current panel into two equal parts: upper and lower |
% | Divide the current panel into two equal parts: left and right |
x | Close the current panel |
! | Place the current panel in a new window; that is, create a new window that contains only the current panel |
Ctrl+arrow keys | Move the edge in units of 1 cell to resize the current panel |
Alt+arrow keys | Move the edge in units of 5 cells to resize the current panel |
Space | Cycle through the 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 |
Arrow keys | Move cursor to select panel |
{ | Displace current panel forward |
} | Displace current panel backward |
Alt+o | Rotate the panel of the current window counterclockwise |
Ctrl+o | Rotate the panel of the current window clockwise |
ctrl+b ?
ctrl+b spacebar
ctrl+b !
ctrl+b " #Model split window
ctrl+b % # Separate windows vertically
ctrl+b q # Display the number of the separated window
ctrl+b o # Jump to the next split window. Switch between multiple screens
ctrl+b up and down keys # Previous and next separated windows
ctrl+b C-arrow keys # Adjust the size of the split window
ctrl+b & # Exit the current tmux after confirmation
ctrl+b [ # Copy mode, that is, move the current screen to the previous position, and all other windows will be moved forward by one.
ctrl+b c # Create a new window
ctrl+b n # Select the next window
ctrl+b l #Last used window
ctrl+b p # Select the previous window
ctrl+b w # Display and select windows in menu mode
ctrl+b s # Display and select sessions in menu mode. This is commonly used. You can choose which tmux to enter.
ctrl+b t # Display the clock. Then press the enter key to return to the shell terminal state.
ctrl+b d # Detach from the current session; this can temporarily return to the Shell interface, and enter tmux attach to re-enter the previous session.
References