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 skills of using Tmux

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

Share

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

This article introduces the relevant knowledge of "what are the skills of using Tmux". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!

Configure terminal default startup tmux

To configure the terminal to automatically start tmux by default, add the following line to the ~/.bashrc startup file, above the aliases section.

linuxidc@linuxidc:~$ sudo nano .bashrc

if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then tmux attach -t default || tmux new -s defaultfi

Save the file and close it.

Every time you open a terminal window, the terminal is closed and reopened by default to start using tmux (as shown below).

Provide terminal session name

tmux provides a default name for the session, but sometimes this name is not descriptive enough. You can specify a name of your choice for the session.

For example, if you are using multiple datacenters, you can name the session "linuxidc1, linuxidc2, etc."

$ tmux new -s linuxidc1$ tmux new -s linuxidc2 switch between tmux terminal sessions

To easily switch between different tmux sessions, you need to enable completion of session names. You can enable it using the tmux completion extension as follows:

$ cd bin$ git clone https://github.com/srsudar/tmux-completion.git

Then find the file ~/bin/tmux-completion/tmux in the ~/ .bashrc file by appending the following lines to it.

source ~/bin/tmux-completion/tmux

Save the file and close it.

Then close and reopen the terminal window, and the next time you enter the following command and press Tab, it should display the possible session names.

$ tmux attach -t Use Tmuxinator Session Manager

Session Manager creates tmux workspaces programmatically by running a series of commands based on configuration. The most widely used tmux session manager is tmuxinator.

Tmuxinator is a utility for easily creating and managing tmux sessions. To use it effectively, you should have a working knowledge of tmux. It is important that you understand the windows and panes in tmux.

Zoom allows you to focus on a single process

Last but not least, after opening each pane, you want to focus on a single process, which you can scale to fill the entire screen. Just move to the pane you want to focus on and press Ctrl+b, z (using the same zoom out).

When the zoom function is complete, press the same key combination to unzoom the pane.

"What are the skills of using Tmux" is introduced here. Thank you for reading it. If you want to know more about industry-related knowledge, you can pay attention to the website. Xiaobian will output more high-quality practical articles for everyone!

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