以下是tmux默认操作快捷键的四栏对照表格,包含了分类、快捷键、说明以及英文名:
| 分类 | 快捷键 | 说明 | 英文名 |
|--------------|-----------------|----------------------------------------------------------------------|--------------------------------------------------------------|
| **基础操作** | Ctrl+b ? | 显示所有快捷键帮助 | Show all keybindings help |
| | Ctrl+b d | 分离当前会话(退出但不关闭,可重新连接) | Detach current session |
| | Ctrl+b : | 进入命令模式(输入tmux命令,如`new - session`、`kill - window`等) | Enter command mode |
| **会话管理** | Ctrl+b s | 列出所有会话,按方向键选择,回车切换 | List all sessions and switch by arrow keys |
| | Ctrl+b $ | 重命名当前会话 | Rename current session |
| | tmux new -s name | 新建会话(终端中执行,非tmux内快捷键) | Create a new session (executed in the terminal) |
| | tmux a -t name | 连接指定会话(终端中执行) | Attach to a specific session (executed in the terminal) |
| | tmux ls | 列出所有会话(终端中执行) | List all sessions (executed in the terminal) |
| **窗口管理** | Ctrl+b c | 新建窗口 | Create a new window |
| | Ctrl+b n | 切换到下一个窗口 | Switch to the next window |
| | Ctrl+b p | 切换到上一个窗口 | Switch to the previous window |
| | Ctrl+b l | 切换到上次使用的窗口(类似浏览器的返回) | Switch to the last - used window |
| | Ctrl+b w | 列出所有窗口,按编号或方向键选择切换 | List all windows and switch by number or arrow keys |
| | Ctrl+b 数字 | 切换到指定编号的窗口(如Ctrl+b 0切换到第0个窗口) | Switch to the window with the specified number |
| | Ctrl+b , | 重命名当前窗口 | Rename the current window |
| | Ctrl+b & | 关闭当前窗口(需确认,按y执行) | Close the current window (confirm by pressing y) |
| **面板管理** | Ctrl+b " | 水平分割面板(上下分屏) | Split the current pane horizontally (into two panes) |
| | Ctrl+b % | 垂直分割面板(左右分屏) | Split the current pane vertically (into two panes) |
| | Ctrl+b o | 切换到下一个面板(顺时针循环) | Switch to the next pane (clockwise) |
| | Ctrl+b 方向键 | 按方向切换到相邻面板(如Ctrl+b ←切换到左侧面板) | Switch to the adjacent pane in the specified direction |
| | Ctrl+b x | 关闭当前面板(需确认,按y执行) | Close the current pane (confirm by pressing y) |
| | Ctrl+b 空格 | 切换面板布局(循环切换预设布局:平铺、主从等) | Cycle through different preset pane layouts |
| | Ctrl+b q | 显示面板编号(1秒后消失,按编号可快速切换到对应面板) | Display pane numbers (disappear after 1 second, switch by number) |
| | Ctrl+b z | 当前面板全屏/取消全屏(暂离其他面板) | Full - screen or un - full - screen the current pane |
| | Ctrl+b { | 交换当前面板与上一个面板位置 | Swap the current pane with the previous pane |
| | Ctrl+b } | 交换当前面板与下一个面板位置 | Swap the current pane with the next pane |
| | Ctrl+b ! | 将当前面板拆分为独立窗口 | Split the current pane into a separate window |
| **复制模式** | Ctrl+b [ | 进入复制模式(类似Vim视图,可滚动查看历史输出) | Enter copy mode (similar to Vim view, can scroll through history) |
| | q | 退出复制模式 | Exit copy mode |
| | 方向键 | 移动光标(复制模式内) | Move the cursor (in copy mode) |
| | Ctrl+空格 | 开始选择文本(复制模式内,类似Vim的v) | Start selecting text (in copy mode, similar to Vim's v) |
| | Alt+w或y | 复制选中的文本到tmux缓冲区 | Copy the selected text to the tmux buffer |
| | Ctrl+b ] | 粘贴复制的内容 | Paste the copied content |
| | / | 复制模式内向前搜索(输入关键词后按Enter,n下一个,N上一个) | Search forward in copy mode (enter keyword and press Enter) |
| | ? | 复制模式内向后搜索 | Search backward in copy mode |
| **其他常用** | Ctrl+b t | 显示时钟(按q关闭) | Display clock (close by pressing q) |
| | Ctrl+b # | 列出当前窗口所有面板的编号 | List the numbers of all panes in the current window |
| | Ctrl+b Ctrl+b | 当按Ctrl+b后,再按Ctrl+b可发送一个Ctrl+b到终端(避免冲突) | Send a Ctrl - b to the terminal (avoid conflict) |
说明:
1. 所有快捷键均以 Ctrl+b 为前缀(称为 “前缀键”),按下后松开,再按第二个键生效。
2. 复制模式默认使用 Emacs 键绑定,若习惯 Vim 操作,可在 ~/.tmux.conf 中添加 setw -g mode-keys vi 切换为 Vim 风格(支持 h/j/k/l 移动、v 选择、y 复制)。
3. 最常用的操作集中在 会话分离(d)、窗口管理(c/n/p/ 数字)、面板分割("/%),建议优先掌握。
4. set -g mouse on 开启鼠标操作
输出当前文件夹为 treeview
a
find . -print | sed -e 's;[^/]*/;|____;g;s;____|; |;g'