当前位置:网站首页>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
边栏推荐
- Lee‘s way of Deep Learning 深度学习笔记
- 腾讯、网易纷纷出手,火到出圈的元宇宙到底是个啥?
- Deep Learning Theory - Initialization, Parameter Adjustment
- LeetCode_22_Apr_2nd_Week
- [CV-Learning] Linear Classifier (SVM Basics)
- MNIST Handwritten Digit Recognition - From Perceptrons to Convolutional Neural Networks
- 【深度学习日记】第一天:Hello world,Hello CNN MNIST
- LeetCode_Dec_1st_Week
- 投稿相关
- 第一章 绪论
猜你喜欢
Copy攻城狮信手”粘“来 AI 对对联
Windows10重置MySQL用户密码
Amazon Cloud Technology Build On 2022 - AIot Season 2 IoT Special Experiment Experience
深度学习,“粮草”先行--浅谈数据集获取之道
Fabric v1.1 环境搭建
MNIST手写数字识别 —— Lenet-5首个商用级别卷积神经网络
No matching function for call to 'RCTBridgeModuleNameForClass'
Copy Siege Lions "sticky" to AI couplets
MNIST手写数字识别 —— ResNet-经典卷积神经网络
target has libraries with conflicting names: libcrypto.a and libssl.a.
随机推荐
Pytest common plug-in
第二章 STA相关概念
tmux概念和使用
CAS无锁队列的实现
Pytorch语义分割理解
Introduction to Convolutional Neural Networks
Copy Siege Lion's Annual "Battle" | Review 2020
[日常办公][ssh]cheatsheet
FAREWARE ADDRESS
【Copy攻城狮日志】飞浆学院强化学习7日打卡营-学习笔记
bind()系统调用的用处
arm-3-中断体系结构
【论文阅读】SPANET: SPATIAL PYRAMID ATTENTION NETWORK FOR ENHANCED IMAGE RECOGNITION
Lee‘s way of Deep Learning 深度学习笔记
LeetCode_Dec_2nd_Week
语音驱动嘴型与面部动画生成的现状和趋势
深度学习理论——过拟合、欠拟合、正则化、优化器
tensorRT教程——tensor RT OP理解(实现自定义层,搭建网络)
Deep Learning Theory - Initialization, Parameter Adjustment
Copy攻城狮5分钟在线体验 MindIR 格式模型生成