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

How to install and use Tmux

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article focuses on "how to install and use Tmux". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and use Tmux.

Install Tmux

Install in Centos/RHEL:

# yum-y install tmux

Install in Ubuntu/Deepin/Debian:

$sudo apt install tmux how to use tmux

After the installation is complete, type tmux to enter the new session.

The characteristics of Tmux terminals are:

Create multiple virtual console vertical or horizontal split panes to resize each pane attach, separate sessions vertically split session panes

To split the tmux vertically, press Ctrl + B, and then press%, and the screen will split vertically.

Split session pane horizontally

To split tmux horizontally, press Ctrl + B and then press "to split the screen horizontally.

Of course, you can mix them together.

How do I switch between sessions?

By default, the Linux console does not support mice. So we need to know how to use keyboard shortcuts to move between panes:

Switch to the left: press Ctrl + b and then the left arrow or, press Ctrl + b and then ``{switch to the right: press Ctrl + b and then the right arrow or, press Ctrl + b and then``} to switch up: press Ctrl + b and then the up arrow to switch down: press Ctrl + b and then the down arrow to switch to the next: press Ctrl + b and then switch between the current pane and the previous pane: press Ctrl + b first; then how to close the session?

You can execute the command exit where you need to close it.

[root@localhost ~ 14:59] # exit detach and attach tmux

One of the advantages of Tmux is that it can separate the tmux without losing anything that is being processed. How to separate? Press Ctrl + b and then d to detach the session.

When you reconnect, you can type tmux attach in the console to attach a window. You need to see which sessions are running first.

[root@localhost ~ 15:22] # tmux ls0: 1 windows (created Fri Jul 3 15:22:45 2020) [119x37]

Then attach the session:

[root@localhost ~ 15:23] # tmux attach creates multiple windows

3-5 panes are probably the most panes on a single window. More than 5 panes will make you feel uncomfortable. To solve this situation, we can create multiple tmux windows.

To create a new window, press Ctrl + b and then c. Then you will see the following message on the status bar: [0] 0 rig rootpack localhostbuds-1 rip rootball localhostrig colors *

Meaning: [0] refers to the first tmux session created. 0 rootless localhostmistmisty-refers to the first window. 1 rootless localhostmisture * refers to the second window, which is currently active.

Rename window name

Switch to the window that needs to be renamed, then press Ctrl + b, and then, the bottom turns orange, delete the previous name and change it to the name that needs to be changed.

Switch between windows (Ctrl-b) + n: switch to the next window (Ctrl-b) + p: switch to the previous window (Ctrl-b) + w: select windows interactively (useful if there are more than two windows)

Close the window

Close the window using (Ctrl-b) + &.

At this point, I believe you have a deeper understanding of "how to install and use Tmux". You might as well do it in practice. 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