Tmux getting started
Introduction
Tmux is a program for window management in linux. Unlike iTerm2, tmux provides a Session storage and restoration function at any time (the Session concept will be introduced later ), detach Session (keep the Session running in the background) and attach the Session again
In common scenarios, multiple tags and files are opened in the company's Terimal. When I got home from work, I suddenly got inspiration and wanted to continue writing. I used ssh to remotely connect to the company's computer, then we found that the tabs and files should be re-opened. If Tmux is used, the current Session of detach will be closed. After going home to ssh remote connection, after attach Session, the scenario will be restored and the programming will continue happily...
Install
# Install the lost package management Homebrew under Mac OS X
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Install Tmux
$ brew install tmux
Basic
# Start Tmux
$ tmux
# Disable Tmux
$ ctrl + d
# Or exit
$ exit
Tmux has three basic concepts: Session, Window, and panel ). after you enter tmux, what tmux actually does is to first create a Session and then create a Window in this Session. You can continue to create multiple windows ), each window contains only one panel. After you continue to split the screen, multiple panels (Pane) will appear. The terminals you see in the window actually belong to a panel of tmux.
Further, the Session can contain multiple windows, and each Window can contain multiple Pane.
Tu
Basic operations
How to execute all shortcut keys:
Presscontrol + bCombine the two buttons and release them.control + b(To tell Tmux that I want to use the Tmux shortcut key), and then trigger various actions by the shortcut key.
For example:C-b ?The execution process is as follows:control + bCombine the two buttons and release them.control + bAnd then press '? 'Key, the list of all Shortcut Keys is displayed.
C-b ?List all shortcut keys and press q or Esc to return
C-b dDetach the current session. You can return to the Shell Interface temporarily and enter tmux attach to re-enter the previous session.
C-b sSelect and switch sessions.
Shortcut Window operation
C-b cCreate a new window
C-b &Close current window
C-b wList all window selections
C-b pSwitch to the previous window
C-b nSwitch to the next window
C-B window numberUse the window number to switch the window (for example, if the window number is 1C-b 1)
C-b ,Rename the current window for easy identification of each window
Pane operation
C-b %Horizontal Terminal
C-b "Vertically split Terminal
C-B direction keyThe Panel is selected freely.
C-b xClose current pane
C-b qDisplay Panel number
Session operation
# Create a new session
$ tmux new-s <name-of-my-session>
# Create a new session in the current Session and ensure that the previous session still exists
# C-B: Enter the following command:
new-s <name-of-my-new-session>
# Enter the session named test
$ tmux attach -t test
C-b sList all sessions
C-b dDetach the current session (which can be considered as running in the background)
Advanced beautification Tmux
Use the Tmux configuration of gpakosz for beautification.
Advantages
- Use
C-aIt is easier to use as a prefix and savesC-bTrigger prefix
- Powerline status bar beautification (familiar with vim)
- Display laptop battery status
Installation and Use
$ cd
$ rm -rf .tmux
$ git clone https://github.com/gpakosz/.tmux.git
$ ln -s .tmux/.tmux.conf
$ cp .tmux/.tmux.conf.local.
Tmux 1.8 released, a Linux terminal multiplexing
Tmux: terminal multiplexing
Simple tmux tutorial
Install and use Tmux in CentOS
Build IDE with Tmux and Vim
Tmux details: click here
Tmux: click here
This article permanently updates the link address: