iTerm2 integrated with Tmux
Recently, when using an open source tool, I found a tool called tmux. Then I found that Tmux is quite popular, the repo star has 20K+, and my commonly used iTerm2 is also integrated with tmux. Based on this, it is necessary to understand tmux and clarify the usage scenarios.
Since the current use is still shallow, please point out if any mistakes
Concept
Start with the concept and understand its function.
tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.
- Personal understanding is that tmux saves the terminal session on-site. For example, SSH is connected to a VPS, vi edit a file, directly closes the session, and then reopens the connection, you will find that the state is lost, you need to re-enter the target path and reopen it edit. With tmux, you can save this session, re-access the target machine, load the previously saved session, and everything will be restored as before.
- The reason why tmux can save sessions is because after tmux is installed on the target server, a separate service will be started for on-site saving.
Tmux Installation
Understand the above principles, you can understand that tmux is not necessarily installed locally, but installed on the machine that needs to save the session
.
The installation commands in common operating system environments are as follows
1 | # macOS |