tmux 命令

这篇是K8S及Rancher部署的前置知识。因为项目部署测试需要,向公司申请了一个虚拟机做服务器用。以下是回溯的命令,多了解了解,拓宽知识面吧。PS:本人小白一个,知识浅显,勿喷。

tmux 常用快捷键

tmux 提供了一系列快捷键来控制会话、窗口和窗格。

默认情况下,tmux 使用 Ctrl-b(即按住 Ctrl 键并按 b 键)作为默认前缀键,用来触发快捷键命令

以下是一些常用的 tmux 快捷键:

  1. 基本导航:

    • Ctrl-b c: 创建新窗口。
    • Ctrl-b n: 切换到下一个窗口。
    • Ctrl-b p: 切换到上一个窗口。
  2. 窗格操作:

    • Ctrl-b %: 垂直分割当前窗格。
    • Ctrl-b ": 水平分割当前窗格。
    • Ctrl-b o: 在窗格间循环切换。
    • Ctrl-b ;: 移动到最后一个窗格(即上一个窗格)。
    • Ctrl-b {: 将当前窗格与前一个窗格交换位置。
    • Ctrl-b }: 将当前窗格与下一个窗格交换位置。
  3. 窗口操作:

    • Ctrl-b w: 显示所有窗口的列表。
    • Ctrl-b ,: 重命名当前窗格。
    • Ctrl-b $: 重命名当前窗口。
  4. 会话操作:

    • Ctrl-b s: 显示所有会话的列表。
    • Ctrl-b d: 脱离当前会话,回到普通 shell。
  5. 复制和粘贴:

    • Ctrl-b [: 进入复制模式。
    • 在复制模式中,使用方向键选择文本。
    • Ctrl-b ]: 粘贴之前复制的文本。
  6. 其他操作:

    • Ctrl-b ?: 显示所有快捷键列表。
    • Ctrl-b t: 显示或隐藏时间戳。
    • Ctrl-b &: 关闭当前窗格。
    • Ctrl-b x: 关闭当前窗格(与 & 相同)。
  7. 配置和退出:

    • Ctrl-b q: 显示工具栏,列出活动的窗格。
    • Ctrl-b :: 进入命令模式,可以输入 tmux 命令。
  8. 会话保存和恢复:

    • Ctrl-b (: 向前滚动(查看历史缓冲区)。
    • Ctrl-b ): 向后滚动(回到之前的视图)。
  9. 锁定终端:

    • Ctrl-b Ctrl-z: 挂起 tmux 会话。
  10. 杀死会话:

    • 在命令模式下输入 kill-session 并按回车,可以杀死当前会话。

以上快捷键是 tmux 的默认设置。

用户可以在 ~/.tmux.conf 配置文件中自定义快捷键。
例如,如果你想更改前缀键为 Ctrl-a,可以在配置文件中添加以下行:

set-option -g prefix C-a

tmux 全部快捷键

C-b C-b Send the prefix key
C-b C-o Rotate through the panes
C-b C-z Suspend the current client
C-b Space Select next layout
C-b ! Break pane to a new window
C-b " Split window vertically
C-b # List all paste buffers
C-b $ Rename current session
C-b % Split window horizontally
C-b & Kill current window
C-b ’ Prompt for window index to select
C-b ( Switch to previous client
C-b ) Switch to next client
C-b , Rename current window
C-b - Delete the most recent paste buffer
C-b . Move the current window
C-b / Describe key binding
C-b 0 Select window 0
C-b 1 Select window 1
C-b 2 Select window 2
C-b 3 Select window 3
C-b 4 Select window 4
C-b 5 Select window 5
C-b 6 Select window 6
C-b 7 Select window 7
C-b 8 Select window 8
C-b 9 Select window 9
C-b : Prompt for a command
C-b ; Move to the previously active pane
C-b = Choose a paste buffer from a list
C-b ? List key bindings
C-b C Customize options
C-b D Choose a client from a list
C-b E Spread panes out evenly
C-b L Switch to the last client
C-b M Clear the marked pane
C-b [ Enter copy mode
C-b ] Paste the most recent paste buffer
C-b c Create a new window
C-b d Detach the current client
C-b f Search for a pane
C-b i Display window information
C-b l Select the previously current window
C-b m Toggle the marked pane
C-b n Select the next window
C-b o Select the next pane
C-b p Select the previous window
C-b q Display pane numbers
C-b r Redraw the current client
C-b s Choose a session from a list
C-b t Show a clock
C-b w Choose a window from a list
C-b x Kill the active pane
C-b z Zoom the active pane
C-b { Swap the active pane with the pane above
C-b } Swap the active pane with the pane below
C-b ~ Show messages
C-b DC Reset so the visible part of the window follows the cursor
C-b PPage Enter copy mode and scroll up
C-b Up Select the pane above the active pane
C-b Down Select the pane below the active pane
C-b Left Select the pane to the left of the active pane
C-b Right Select the pane to the right of the active pane
C-b M-1 Set the even-horizontal layout
C-b M-2 Set the even-vertical layout
C-b M-3 Set the main-horizontal layout
C-b M-4 Set the main-vertical layout
C-b M-5 Select the tiled layout
C-b M-n Select the next window with an alert
C-b M-o Rotate through the panes in reverse
C-b M-p Select the previous window with an alert
C-b M-Up Resize the pane up by 5
C-b M-Down Resize the pane down by 5
C-b M-Left Resize the pane left by 5
C-b M-Right Resize the pane right by 5
C-b C-Up Resize the pane up
C-b C-Down Resize the pane down
C-b C-Left Resize the pane left
C-b C-Right Resize the pane right
C-b S-Up Move the visible part of the window up
C-b S-Down Move the visible part of the window down
C-b S-Left Move the visible part of the window left
C-b S-Right Move the visible part of the window right

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值