In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "the installation and usage introduction of tmux in CentOS". In the daily operation, I believe that many people have doubts about the installation and usage of tmux in CentOS. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts about the installation and usage of tmux in CentOS. Next, please follow the editor to study!
Why use tmux?
What is tmux? Tmux is a program that manages windows in linux. So here's the problem: the Iterm2 that comes with Mac works well. It not only supports multiple tags, but also supports the segmentation of Panel inside the form, so why use tmux? In fact, multi-tagging and splitting forms are only part of the functionality of tmux. The main reason for using tmux is that it provides a window group to store and restore at any time. See if the following usage scenarios are right for you:
The company's desktops have a bunch of vim and log print windows off duty. After arriving home, I was suddenly inspired and wanted to continue coding. After logging in to VPN,SSH and connecting to the desktop, I found that I had to reopen various windows. I was not in the mood for a moment. FML! At this point, you can install a tmux on your company desktop. The same set of work environment is shared in many places.
Debug the program on the company server and open a bunch of windows. I went out for dinner and found that SSH was running out of time, broken pipe. Start all over again. FML! If you had used tmux before, there would have been no such problem, and attach would have been able to find the windows that were originally opened.
The basic concept of tmux
Let's first understand a few elements of tmux. The main elements of tmux are divided into three layers:
Session A collection of windows, usually used to summarize the same task. Session can have its own name to facilitate switching between tasks.
Window a single visible window. Windows has its own number, which can also be considered similar to Tab in ITerm2.
Pane pane, a window that is divided into small blocks, similar to the effect of Cmurw + v in Vim.
For a better understanding, here are three elements that are represented in tmux.
You can see that Session is always displayed in the lower-left corner of tmux and is usually named for him. For example, I am writing a blog, and I have a lot of windows open, so I will name this group of windows reconnect and switch after blog convenience. The Window will also be presented in the form of a Tab at the bottom. Each window has its own needs and will be named after the currently active process. Pane, on the other hand, is easier to understand, that is, the elements after dividing a single window into several small blocks.
Install under CentOS
First, I tried to install it with yum install tmux. It is estimated that there is no source, no tmux found. So habitually go directly to the source code installation.
But there are dependencies, so you need to install libevent first.
The code is as follows:
Wget https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz
Tar xzvf libevent-2.0.21-stable.tar.gz
Cd libevent-2.0.21-stable
. / configure & & make
Make install
Then download the source code to install tmux
The code is as follows:
Git clone git://git.code.sf.net/p/tmux/tmux-code tmux
Cd tmux
Sh autogen.sh
. / configure & & make
Make install
In the process, I encountered two errors, both of which were relatively simple, of course, after consulting the data.
Question 1:
During this time, I encountered an error when executing autogen.sh because I did not install automake. This is simply solved by direct yum install automake.
Question 2:
Encountered during execution
Libevent-2.0.so.5: cannot open shared object file: No such file or directory
The solution is also relatively simple, since you can't find it, find another place where you can find it.
The code is as follows:
Ln-s / usr/local/lib/libevent-2.0.so.5 / usr/lib/libevent-2.0.so.5 # 32-bit system
Ln-s / usr/local/lib/libevent-2.0.so.5 / usr/lib64/libevent-2.0.so.5 # 64-bit system
Use and shortcut keys
Enter tmux directly on the command line to enter tmux mode.
Tmux mainly includes windows forms operation and Pane operation. Personally, windows doesn't mean much to me (it doesn't mean that windows mode is not suitable for scenarios), so here we mainly talk about the related operations of Pane.
Shortcut key
For tmux shortcuts, press Cmurb (Ctrl-b) first. Then press the contents of the table below to achieve the corresponding effect.
Session and other related shortcut keys
Shortcut key function Cmerz closes tmux.: and enters tmux command line mode.? List all shortcuts. T display time. D exit the current tmux client, tmux background run. $rename the current session.s toggle session to display all session and switch to a certain session. (switch session to the previous session.) Switch session to the next session.L switch session to the previous active session.
Window related shortcut key
Shortcut key function c add a window.& to exit the current window., rename the current window.l jump to the previous window.i to display the current window information. W switch window to display all window and switch window.0 to 9 switch window to the corresponding number window.p switch window previous window.n switch window next window.' Switch window to input numbered window.f switch window to searched window.Space to change the pane layout under the current window.
Pane related shortcut key
Shortcut key function! Remove the current pane from the window. "change the current pane to two pane.% up and down, turn the current pane to the left and right, turn off the current pane.q display pane index .z maximize or restore the current pane. {swap position with the previous pane.} swap position with the latter pane. O switch Pane to the next pane.; switch Pane to the previous operation pane.Up, Down Left, Right
Switch Pane use the arrow keys to switch to the corresponding direction of the pane.
There may be some shortcuts and some discrepancies. Remind me if you can. In addition, some shortcuts are not understood, and there are more shortcuts. I think it is enough to remember the main switching shortcuts. Compare tmux is just an assist tool, there is no need to pay so much attention to it. The bold one is something I think is more practical.
Tmux's mode of not interrupting session is really 666666, and you can quickly connect to the environment that ended last time every time you connect it back. And multiple pane is also very suitable for enabling and monitoring multiple services.
At this point, the study of "introduction to the installation and usage of tmux in CentOS" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
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.