In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Editor to share with you how to install and use tmux under Linux, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Tmux is a terminal multiplexing artifact on Linux that manages multiple terminals (pseudo terminals, to be exact) from a single screen. With this tool, users can connect or disconnect the session while keeping the terminal running in the background.
Install and start tmux
The name of a tmux application comes from a terminal (terminal) multiplexer (muxer) or a multiplexer (multiplexer). In other words, it can divide your single-terminal session into multiple sessions. It manages windows and panes:
A window is a single view-that is, the various things displayed in the terminal. The pane is part of the view, which is usually a terminal session.
Before you start, please install the tmux application on the system. You need to set up sudo permissions for your user account or use the root account.
Sudo dnf-y install tmux [Fedora 22] sudo yum-y install tmux [Centos or RHEL] sudo apt-get-y install tmux [ubuntu]
Run the tmux program:
Tmux status bar
First, nothing seems to happen, except for the status bar at the bottom of the terminal:
The bottom column says: [0]-this is the first session created by the tmux server. The number starts at 0. The tmux server tracks all sessions to see if they are alive. 0Rule testusername scarlettRose ~-Information about the first window of the session. The number starts at 0. This means that the terminals in the active pane of the window are owned by the testuser user in the hostname scarlett. The current directory is ~ (home directory). *-shows that you are currently in this window. "scarlett.internal.fri"-the hostname of the tmux server you are using. "in addition, the date and time on that particular host are displayed."
As you add more windows and panes to the session, the information bar will change.
Basic knowledge of tmux
Stretch your terminal window to the maximum. Now let's try some simple commands to create more panes. By default, all commands start with Ctrl+b.
Tap Ctrl+b, "split the current single pane horizontally. There are now two command line panes in the window, one at the top and one at the bottom. Notice that the new pane at the bottom is the active pane. Click Ctrl+b to split the current single pane vertically. Now you have three command line panes in your window, and the lower right corner pane is the active pane. The artifact that is better than Screen: tmux is better than Screen: tmux.
Notice the highlighted border around the current pane. To browse all the panes:
Click Ctrl+b, then click the arrow key to tap Ctrl+b, Q, and the number will appear briefly on the pane. In the meantime, you can browse the corresponding numbers on the pane you want to browse.
Now, try running different commands using different panes. For example, the following:
Use the ls command to display the contents of the directory in the top pane. Use the vi command in the lower left pane to edit a text file. Run the top command in the lower right pane to monitor the system process.
The screen will be displayed as follows:
So far, only one window with multiple panes has been used in this example, and you can also run multiple windows in a session.
To create a new window, click Ctrl+b, c. Notice that the status bar shows that there are two windows currently running. (keen readers will see the screenshot above. To move to the previous window, click Ctrl+b, p. To move to the next window, click Ctrl+b, n. To move to a specific window immediately, click Ctrl+b and follow the window number.
If you want to know how to close panes, just use exit, logout, or Ctrl+d to exit a specific command line shell, and once you close all the panes in the window, the window will disappear.
Detach and attach
One of the most powerful features of tmux is the ability to detach and reattach to a session. When you leave, you can leave your windows and panes to run independently. In addition, you can even log out of the system completely. You can then log in to the same system, reattach to the tmux session, and view all windows and panes when you leave. The command you run remains running when you leave it.
To break away from a conversation, please Ctrl+b, d. Then the session disappears and you return to a standard single shell. If you want to reattach to the session, use the following command:
Tmux attach-session
This function is as useful as a lifeguard when the network you connect to the host is unstable. If the connection fails, all processes in the session continue to run. As long as the connection is restored, you can return to normal as if nothing had happened.
If these features are not enough, you can run multiple sessions in the top-level windows and panes of each session. You can list these windows and panes and append them to the correct session by number or name:
Tmux list-sessions above is all the contents of the article "how to install and use tmux under Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.