Previously introduced the Linux Screen command, today introduced a more powerful terminal tool Tmux.
Tmux is a tool for running multiple terminal sessions in a terminal window. It can basically replace nohup and screen, even more powerful:
Screen projects have largely terminated, and there are a lot of problems in the code that are very unstable to use;
Tmux is an active project, its code base is constantly updated and its design is better
Tmux is using a real client/server model, and screen just simulates the behavior of this model;
Tmux can better support the split screen function.
Tmux is not a Linux default configuration and needs to be installed on its own. You can use homebrew to install in Mac OS. Installation Tmux can be done using the Brew install tmux command.
In order to make its own shortcut keys and other software shortcut keys do not interfere with each other, like screen, Tmux provides a shortcut key prefix. When you want to use a shortcut key, you need to press the shortcut key prefix before pressing the shortcut key. The shortcut key prefix used by TMUX is the combination key ctrl-b (press Ctrl and the B key at the same time). For example, if you want to list the sessions in the current Tmux with shortcut keys (the corresponding shortcut is s), then you only need to do the following steps:
Press the combination key Ctrl-b (Tmux shortcut key prefix)
Release the combo key ctrl-b
Press the S key
Tmux's shortcut key prefix is similar to screen, except that screen is ctrl-a, and Tmux is ctrl-b.
Tmux can create multiple sessions, each with multiple windows, and each window can contain multiple panes.
Tmux common commands are as follows, we put ctrl-b shorthand for c-b:
Tmux--------------> Create a Tmux session
Tmux ls--------------> Show list of Tmux sessions (C-b s)
Tmux a-t Digital--------------> select Tmux session
C-b C--------------> Create a new Window
C-b n--------------> switch to the next window
C-b P--------------> switch to previous window
C-b L--------------> switch to the last window
C-b w--------------> select Open Session in Current window by the up and down key
C-b Digital--------------> Jump directly to the window where you press the number
C-b &--------------> exit the current Window
C-b d--------------> Temporary disconnect session after disconnection, you can also connect the yo:)
C-b "--------------> Split out a window (split up and down)
C-b%--------------> split out a window (split left and right)
C-b o--------------> switch in a small window, suitable for use when two windows
C-b (arrow key)--------------> select Small window in the direction, suitable for multiple windows
C-b! --------------> Close all small windows
C-b x--------------> Close the small window at the current cursor
C-b T--------------> Clocks can actually be seen as a screensaver
C-b Pageup/pagedown--------------> Scroll up and down to view history; if it is a Mac machine, you can use the command+ up and down arrows to flip the screen, because there are no pageup and PageDown keys. But the actual effect did not see the historical record.
C-b,--------------> Modify the current window name
Linux Essentials Tool Tmux