|
Tmux role is to reuse the terminal.
1. Start a bash on the server, and run inside tmux
2. Log in via ssh remote server, run tmux attach, it will switch to the bash server on the subsequent operations are in a bash
3. You can open more windows, so that the remote can be the same as in the local use of multiple same bash
If you want to send the command, as follows:
tmux send -t checkpoint ls ENTER
NOTE: checkpoint you've created a good session with tmux name (tmux new -s checkpoint); ls is a shell command; plus ENTER to execute the ls command in this session of the checkpoint.
So you do not have to manually tmux attach to that session, and then manually execute the ls command. It is good to use a script.
If the session has multiple windows:
tmux send -t checkpoint: 0 'mongoose -t 2' ENTER
0 represents the first window.
Combined with parallel-ssh you can use the remote server environment to run the bash command.
Such a scenario is useful. On a single server with criu to a small program checkpoint, require criu and applets run in bash, rather than directly in ssh, otherwise img file checkpoint obtained will contain information related to the terminal associated with the ssh ( session id), so you can not restore it on another server, and that is impossible to achieve migration. And if in bash, and ssh will not have information about, and on another machine you can restore.
tmux Shortcuts
tmux use a lot of shortcuts in the session to control multiple windows, multiple sessions and the like.
Ctrl + b # to activate the console; this time the following keypresses
System Operation
? # List all shortcuts; press q to return
d # departing from the current session; this can temporarily return to Shell interface, enter tmux attach to re-enter the previous session
D # Select from the session; used when multiple sessions open simultaneously
Ctrl + z # suspend the current session
r # redrawn without departing from the mandatory session
Used in multiple sessions open simultaneously; s # choice and switch sessions
: # Enter the command line mode; then you can enter commands supported, such as kill-server can shut down the server
[# Enter the copy mode; this time the same operation as vi / emacs, press q / Esc to exit
~ # List message cache; which contains a variety of message before returning tmux
Window Operations
c # create a new window
& # Close the current window
# Numeric keys to switch to the specified window
p # to switch to the previous window
n # Switch to the next window
l # switch back and forth between each other in two windows
w # through the window list window switch
# Rename the current window; it is easy to identify
# Modify the current window number; corresponds to the window to reorder
f # Find the specified text in all windows
Panel Operation
"# The current flat panel is divided into two
% # About the current panel is divided into two levels
x # close the current panel
! # The current panel placed in a new window; that is, a new window that contains only the current panel
Ctrl + arrow keys # 1 to the cell edge for mobile unit to adjust the size of the current panel
Alt + arrow keys to # 5 cell edge for mobile unit to adjust the size of the current panel
Space # in the preset panel layout to cycle; in turn includes even-horizontal, even-vertical, main-horizontal, main-vertical, tiled
q # Display Panel No.
o # Select the next panel in the current window
# Move the cursor arrow keys to select the panel
{# Forward displacement of the current panel
} # Rearward displacement of the current panel
Alt + o # counterclockwise rotation of the current window panel
Ctrl + o # clockwise rotation of the current window panel |
|
|
|