Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Tmux terminal commands?

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the Tmux terminal commands". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the Tmux terminal commands.

1. Introduction of the command:

Tmux (short for "Terminal Multiplexer") is an excellent terminal reuse software, similar to GNU screen, but better than screen. Tmux comes from OpenBSD and is licensed by BSD. The most intuitive advantage of using it is that after logging in to a remote host and running tmux through a terminal, you can open multiple consoles without having to "waste" extra terminals to connect to the remote host. Another advantage is that when the terminal is closed, the task process running in the shell will be interrupted. This problem can be easily solved by using tmux.

2. Use scenarios:

\ 1. When you close the terminal and open it again, the task process in the original terminal will not be interrupted.

\ 2. Two people in a long distance can operate on the same conversation, and the operation of one side can be seen in real time by the other.

\ 3. You can open many terminals under the flexible layout of a single screen, and then you can use them collaboratively.

Third, the usage of commands:

First install the command (EPEL repo is required for CentOS):

[root@ames ~] # cat / etc/RedHat-releaseCentOS Linux release 7.3.1611 (Core) [root@ames ~] # yum-y install tmux

View the usage of the command:

[root@ames ~] # tmux-- helpusage: tmux [- 28lquvV] [- c shell-command] [- f file] [- L socket-name] [- S socket-path] [command [flags]] [root@ames ~] #

Introduction to individual options and parameters:

\ 1. Run tmux:

[root@ames ~] # tmux

\ 2. Create a new session: # tmux new-s SESSION-NAME

(note: SESSION-NAME represents the session name, which can be alphabetic or numeric)

Or you don't have to specify a session name (not recommended): # tmux new

[root@ames] # tmux new-s second-tmux

\ 3. View the created session:

[root@ames ~] # tmux ls

\ 4. Enter a known session: # tmux a-t SESSION-NAME or # tmux attach-t SESSION-NAME

[root@ames] # tmux ls0: 1 windows (created Wed Aug 30 11:15:29 2017) [61x16] second-tmux: 1 windows (created Wed Aug 30 11:23:51 2017) [85x16] [root@ames] # tmux a-t second-tmux

\ 5. Temporarily leave the current session:

(the command will be withdrawn from the current session, which is why it will be said to reconnect to the session later)

[root@ames ~] # tmux detach

\ 6. Close the session: # tmux kill-session-t SESSION-NAME

(can be executed either inside or outside the session)

[root@ames ~] # tmux ls0: 1 windows (created Wed Aug 30 11:15:29 2017) [61x16] second-tmux: 1 windows (created Wed Aug 30 11:40:24 2017) [85x16] [root@ames] # tmux kill-session-t second-tmux [root@ames ~] # tmux ls0: 1 windows (created Wed Aug 30 11:15:29 2017) [61x16] [root@ames] #

Note: 1. Run the tmux command alone, that is, start a tmux session; 2. If you cannot create a new session in a tmux session, an error will occur: "sessions should be nested with care, unset $TMUX to force"

4. Split screen operation:

In many cases, we need to run multiple commands and perform multiple tasks in a session, and we can organize them in multiple windows of a session.

\ 1. Split screen: horizontal split screen and vertical split screen

Horizontal split screen

Shortcut key: press ctrl+b first, release and then press%

Vertical split screen

Shortcut key: press ctrl+b first, release and then press "

The cursors in the window after the split screen switch with each other.

Shortcut key: press ctrl+b first, release and then press o

Switch tmux session terminal

Shortcut key: press ctrl+b first, release and then press s

Display time in the terminal

Shortcut key: press ctrl+b first, release and then press t

Exit time interface: press Q key

five。 Other shortcut key operation

Terminate a terminal window (confirmation required)

Shortcut key: exit or press ctrl+b first, release and then press &

Open a new window based on the current window

Shortcut key: press ctrl+b first, release and then press c

Temporarily exit the current session

Shortcut key: press ctrl+b first, release and then press d

View panel number

Shortcut key: press ctrl+b first, release and then press Q

Close all split-screen windows, that is, merge into one window

Shortcut key: press ctrl+b first, release and then press!

At this point, I believe you have a deeper understanding of "what are the Tmux terminal commands?" you might as well come to the actual operation! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report