当前位置:网站首页>tmux concept and usage
tmux concept and usage
2022-08-04 06:29:00 【KuoGavin】
什么是tmux?Github的地址:https://github.com/tmux/tmux
可见tmux是一个终端多路复用器,Able to create in single screen condition,Access and control multiple terminal windows.At the same time, it can continue to run in the background of the host after the terminal window is disconnected,You can also reconnect later.That is, the advantages are as follows:
- split your terminal into panes which can be moved, resized, and switched between
- keep programs running after you disconnect (e.g. when working on a remote server via ssh)
tmux 安装
- Ubuntu:
sudo apt-get install tmux
- RedHat / CentOS:
sudo yum install tmux
tmux 命令
在 tmux 中,有session(会话)、window(窗口)和 pane(窗格)三个概念:
- Sessions:Defines the overall task currently being done.If you are testing something,All operations and activities related to testing the thing are limited to the current session;
- Windows:Refers to a specific activity or project within a session;
- Panes:Helps programmers create multiple view panes in one window.比如,Runs in a pane,Track the error log in another pane;
structurally,就是一个 tmux 可以包含多个 session,一个 session 可以包含多个 window, 一个 window 可以包含多个 pane.
Here's a more comprehensive one tmux command manual,and is online,Paste the URL:https://phoenixnap.com/kb/tmux-tutorial-install-commands
tmux 的控制方式是——按过CTRL+b
(Default prefix key)之后,Press the corresponding hotkey again.(CTRL+b
The keys are a bit awkward,That is, the two buttons are far apart,可以修改~/.tmux.conf
The content of the file is modified with the prefix,并在tmux当中执行tmux source-file ~/.tmux.conf
生效,The specific operation will be described below,同时AcWing中,yxcChange it to CTRL+a
,Also commonly used modified prefix combinations).
Talk about prefix combinations+After the control method of the hotkey,常用的操作命令如下:
|session相关|
The approximate content is :新建 session -> 离开 session -> 查看 session 列表 -> 进入 session -> 关闭 session -> 不同 session 之间的切换 -> 重命名 session .
操作方式 | 用法 |
---|---|
tmux | 新建一个session,其中包含一个window,window包含一个pane,paneopened inshell |
tmux new -s session_name | Create a new one with the specified namesession_name的会话,其余同上 |
tmux detach CTRL+b 手指松开,d | 离开session,Exit from the current session,Meanwhile tasks for the current session are still running in the background |
tmux ls | 查看 session 列表,List all activesession |
tmux a / tmux attach tmux a -t session_name | 打开之前挂起的session,即Enter the most recently used session that is still in progress 打开/Enters a pending session of the specified name |
tmux kill-session -t session_name | 关闭名为session_name的session |
CTRL+b 手指松开,s | 同tmux ls ,View all operationssession;还可选择其它session/window/pane,会有一个GUIinterface for selection: → :展开当前项 session/window← :闭合当前项 session/window↑ :选择上一项 session/window/pane↓ :选择下一项 session/window/pane |
tmux switch -t session_name | 切换session |
tmux rename-session -t old_session_name new_session_name CTRL+b Press and release,$ | 重命名当前session名 |
|window相关|
操作方式 | 用法 |
---|---|
tmux new-window -n window_name CTRL+b 手指松开,c | 新创建一个window,在当前session中创建一个新的window |
tmux select-window -t window_name CTRL+b 手指松开,w | 选择指定window_namename of the window 选择其它window,会有一个GUIinterface for selection: → :展开当前项 window← :闭合当前项 window↑ :选择上一项 window/pane↓ :选择下一项 window/pane |
tmux rename-window new_window_name CTRL+b 手指松开,, | 操作之后,The bottom status bar turns yellow,删除原window名,Change the new onewindow名 |
tmux kill-window -t window_name CTRL+b 手指松开,& | 关闭当前窗口/(再按y 进行确认) |
CTRL+b 手指松开,PgUp 鼠标滚轮 | 翻阅当前pane内的内容 |
|pane相关|
在使用vimeditor is used during the process tmux The pane is a very lighthearted thing.
操作方式 | 用法 |
---|---|
tmux split-window -h CTRL+b 手指松开,% | 将当前paneDivide left and right |
tmux split-window CTRL+b 手指松开," | 将当前paneHalf up and down |
CTRL+d CTRL+b 手指松开,x 输入exit+ Enter | 关闭当前pane,若当前window的所有pane关闭,则自动关闭window,session的window同理,类似shared_ptr的回收 |
tmux select-pane -U/D/L/R CTRL+b 手指松开, <方向键>`鼠标点击pane | U(Upward)/D(Downward)/L(Left)/R(Right) 选择相邻的pane 选择任意的pane |
CTRL+b 的同时按<方向键> 鼠标拖动pane之间分割线 | 调整pane之间分割线的位置 |
CTRL+b 手指松开,z | 将当前pane全屏/取消全屏 |
CTRL+b 手指松开,t | Displays the clock in the current pane,点击Enter复原 |
在 tmux When text is selected,需要按住 Shift 键.(仅支持Windows和Linux,不支持MacOS);
在 tmux 中复制/粘贴文本的通用方式:
- ① 按下
CTRL+b
后松开手指,然后按[
; - ② 用鼠标选中文本,The selected text is automatically copied to tmux 的剪贴板;
- ③ 按下
CTRL+b
后松开手指,然后按]
,会将剪贴板中的内容粘贴到光标处;
tmux 配置
通过编辑~/.tmux.conf
文件对 tmux 进行个性化配置,This is a separate configuration for the current user,If you want to configure all users of the host,则在根目录下创建/etc/tmux.conf
文件.
Change the prefix combination,以CTRL+b改为CTRL+a为例:
unbind C-b
set -g prefix C-a
更改后保存即可.
Change shortcut keys for dividing windows,将左右,The upper and lower divisions were changed toCTRL+b,h
和CTRL+b,v
unbind %
bind h split-window -h
unbind '"'
bind v split-window -v
Give a recommended configuration,It's a bit gimmicky but practical:https://github.com/gpakosz/.tmux
边栏推荐
- MNIST Handwritten Digit Recognition - From Perceptrons to Convolutional Neural Networks
- MNIST手写数字识别 —— 从零构建感知机实现二分类
- 计算某像素点法线
- Pytest common plug-in
- target has libraries with conflicting names: libcrypto.a and libssl.a.
- The second official example analysis of the MOOSE platform - about creating a Kernel and solving the convection-diffusion equation
- lstm pipeline 过程理解(输入输出)
- 双向LSTM
- Thunderbolt turns off automatic updates
- 题目1000:输入两个整数a和b,计算a+b的和,此题是多组测试数据
猜你喜欢
【论文阅读】Exploring Spatial Significance via Hybrid Pyramidal Graph Network for Vehicle Re-identificatio
【Copy攻城狮日志】飞浆学院强化学习7日打卡营-学习笔记
MNIST handwritten digit recognition, sorted by from two to ten
YOLOV5 V6.1 详细训练方法
深度学习理论 —— 初始化、参数调节
LeetCode_Nov_4th_Week
"A minute" Copy siege lion log 】 【 run MindSpore LeNet model
yoloV5 使用——训练速度慢,加速训练
【Copy攻城狮日志】“一分钟”跑通MindSpore的LeNet模型
Windows10重置MySQL用户密码
随机推荐
[开发杂项][编辑器][代码阅读]ctags&vim
[CV-Learning] Linear Classifier (SVM Basics)
中国联通、欧莱雅和钉钉都在争相打造的秘密武器?虚拟IP未来还有怎样的可能
【Copy攻城狮日志】飞浆学院强化学习7日打卡营-学习笔记
Unity ML-agents 参数设置解明
PCL窗口操作
Copy攻城狮5分钟在线体验 MindIR 格式模型生成
LeetCode_Dec_2nd_Week
Pytest common plug-in
Copy Siege Lion's Annual "Battle" | Review 2020
详解近端策略优化
MNIST Handwritten Digit Recognition - Lenet-5's First Commercial Grade Convolutional Neural Network
TensorRT 5 初步认识
The usefulness of bind() system call
迅雷关闭自动更新
DRA821 环境搭建
FAREWARE ADDRESS
如何用Pygame制作简单的贪吃蛇游戏
[Deep Learning Diary] Day 1: Hello world, Hello CNN MNIST
MOOSE平台使用入门攻略——如何运行官方教程的例子