Linux operating system - tmux command graphic tutorial

Table of contents

1. Introduction to tmux

1.1. tmux concept

1.2. tmux installation

2. tmux start

3. Split window

4. Switch cursor position

5. Close the child window

6.tmux page turning


1. Introduction to tmux

1.1. tmux concept

        tmux is a terminal multiplexer that allows you to run multiple terminal sessions simultaneously in a single terminal window. The name of tmux is an abbreviation of "Terminal Multiplexer" (Terminal Multiplexer). Its main function is to help users manage and organize terminal sessions to improve work efficiency and convenience.

1.2. tmux installation

# Ubuntu or Debian
sudo apt-get install tmux

# CentOS or Fedora
sudo yum install tmux

# Mac
brew install tmux

    The blogger is using the ubuntu 20.04 system, using the first command, and the same is true for other systems. The installation information is shown in the figure below:

2. tmux start

        Terminal input: tmux, enter the tmux window. After entering the tmux interface, you will be asked to enter the account password. After entering the password, you can use tmux related commands to manage the terminal.

3. Split window

        Splitting windows can help us split multiple small windows in one terminal and execute different commands in multiple small windows. For example, a small window compiles code, a small window performs simulation, and a small window edits text, etc.

Split the window left and right: ctrl + b to enter the edit mode, then enter %;

Split the window up and down: ctrl + b to enter the edit mode, then enter ";

        The split window operation can be used multiple times. For example, split the window left and right first, then split the window up and down on the right, as shown in the following figure:

4. Switch cursor position

        After a terminal is divided into multiple windows, you can enter ctrl + b to enter the editing mode , and then use the keyboard ↑ ↓ ← → to control the cursor position .

5. Close the child window

        Enter ctrl + d in the terminal to delete the window where the current cursor is located, which is usually used in conjunction with splitting windows.

6.tmux page turning

        In the windows and sub-windows opened on the tmux interface, when we want to view the program running log output by the terminal, we cannot directly view the historical log through the mouse wheel or the small keyboard up, down, left, and right, but need to use commands.

Enter ctrl + b in the terminal to enter the edit mode, and then enter [ to enter the view mode

In view mode, you cannot enter commands in the terminal, press q to exit view mode

        As shown in the figure below, after entering the viewing mode, a serial number will appear in the upper right corner of the terminal, representing the current line and the total number of lines. Note that in the viewing mode, only the historical log can be viewed, and terminal commands cannot be entered. You need to press q to exit the viewing mode before entering terminal commands .

 

 

Guess you like

Origin blog.csdn.net/qq_57502075/article/details/131301707