If there is only one pane (i.e. the window is not split into multiple panes, <Prefix>x would kill the window)
As always iterated, <Prefix> is generally CTRL+b. (I think for beginner questions, we can just say CTRL+b all the time, and not talk about prefix at all, but anyway :) )
Kent 的回复完全回答了您的问题,但是如果您希望将 tmux 的配置更改为类似于 GNU Screen,这里有一个我用来完成此操作的 tmux.conf:
# Prefix key
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Keys
bind k confirm kill-window
bind K confirm kill-server
bind % split-window -h
bind : split-window -v
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
bind . command-prompt
bind a last-window
bind space command-prompt -p index "select-window"
bind r source-file ~/.tmux.conf
# Options
set -g bell-action none
set -g set-titles on
set -g set-titles-string "tmux (#I:#W)"
set -g base-index 1
set -g status-left ""
set -g status-left-attr bold
set -g status-right "tmux"
set -g pane-active-border-bg black
set -g pane-active-border-fg black
set -g default-terminal "screen-256color"
# Window options
setw -g monitor-activity off
setw -g automatic-rename off
# Colors
setw -g window-status-current-fg colour191
set -g status-bg default
set -g status-fg white
set -g message-bg default
set -g message-fg colour191
Kent's response fully answered your question, however if you are looking to change tmux's configuration to be similar to GNU Screen, here's a tmux.conf that I've used to accomplish this:
# Prefix key
set -g prefix C-a
unbind C-b
bind C-a send-prefix
# Keys
bind k confirm kill-window
bind K confirm kill-server
bind % split-window -h
bind : split-window -v
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
bind . command-prompt
bind a last-window
bind space command-prompt -p index "select-window"
bind r source-file ~/.tmux.conf
# Options
set -g bell-action none
set -g set-titles on
set -g set-titles-string "tmux (#I:#W)"
set -g base-index 1
set -g status-left ""
set -g status-left-attr bold
set -g status-right "tmux"
set -g pane-active-border-bg black
set -g pane-active-border-fg black
set -g default-terminal "screen-256color"
# Window options
setw -g monitor-activity off
setw -g automatic-rename off
# Colors
setw -g window-status-current-fg colour191
set -g status-bg default
set -g status-fg white
set -g message-bg default
set -g message-fg colour191
While you asked how to kill a window resp. pane, I often wouldn't want to kill it but simply to get it back to a working state (the layout of panes is of importance to me, killing a pane destroys it so I must recreate it); tmux provides the respawn commands to that effect: respawn-pane resp. respawn-window. Just that people like me may find this solution here.
发布评论
评论(11)
尝试
Prefix
+ &如果您
的
.tmux.conf
中有,您可以按Prefix
+ q 也杀死窗口,前提是该窗口中只有一个面板。如果您有多个窗格并希望立即终止整个窗口,请在配置中使用
killw
而不是killp
。上面的Prefix默认是 Ctrl+b,
默认情况下,您可以使用终止窗口 Ctrl+b &
try
Prefix
+ &if you have
in your
.tmux.conf
, you can pressPrefix
+ q to kill the window too, only if there is only one panel in that window.if you have multiple panes and want to kill the whole window at once use
killw
instead ofkillp
in your config.the default of Prefix above is Ctrl+b,
so to terminate window by default you can use Ctrl+b &
&
用于终止窗口x
用于终止窗格如果有只有一个窗格(即窗口未拆分为多个窗格,
x
会杀死该窗口)一如既往,< /code> 一般是
CTRL+b
。 (我认为对于初学者问题,我们可以一直说CTRL+b
,根本不谈论前缀,但无论如何:))<Prefix>
&
for killing a window<Prefix>
x
for killing a paneIf there is only one pane (i.e. the window is not split into multiple panes,
<Prefix>
x
would kill the window)As always iterated,
<Prefix>
is generallyCTRL+b
. (I think for beginner questions, we can just sayCTRL+b
all the time, and not talk about prefix at all, but anyway :) )一般来说:
例如,如果您在窗口 1 中并且想要终止窗口 9:
Generally:
So for example, if you are in window 1 and you want to kill window 9:
对我来说,解决方案如下所示:
ctrl+b q
显示窗格编号。ctrl+b x
终止窗格。杀死最后一个窗格将杀死窗口。
For me solution looks like:
ctrl+b q
to show pane numbers.ctrl+b x
to kill pane.Killing last pane will kill window.
Kent 的回复完全回答了您的问题,但是如果您希望将 tmux 的配置更改为类似于 GNU Screen,这里有一个我用来完成此操作的 tmux.conf:
Kent's response fully answered your question, however if you are looking to change tmux's configuration to be similar to GNU Screen, here's a tmux.conf that I've used to accomplish this:
如果您只想执行一次,而不添加快捷方式,您可以随时键入
If you just want to do it once, without adding a shortcut, you can always type
ctrl + d
在 Linux 终端中杀死一个窗口,在 tmux 中也有效。这是一种方法。
ctrl + d
kills a window in linux terminal, also works in tmux.This is kind of a approach.
有很多不同的方法可以做到这一点,但我最喜欢的是在 bash 提示符下输入“exit”。
Lot's of different ways to do this, but my favorite is simply typing 'exit' on the bash prompt.
当你问如何杀死一个窗口时。窗格,我通常不想杀死它,而只是想让它恢复到工作状态(窗格的布局对我来说很重要,杀死窗格会破坏它,所以我必须重新创建它); tmux 提供了
respawn
命令来达到此效果:respawn-pane
resp。重生窗口
。只是像我这样的人可能会在这里找到这个解决方案。While you asked how to kill a window resp. pane, I often wouldn't want to kill it but simply to get it back to a working state (the layout of panes is of importance to me, killing a pane destroys it so I must recreate it); tmux provides the
respawn
commands to that effect:respawn-pane
resp.respawn-window
. Just that people like me may find this solution here.默认情况下
<前缀>
&用于杀死窗口
x 用于终止窗格然后您可以添加配置信息
X 用于终止会话By default
<Prefix>
& for killing a window<Prefix>
x for killing a paneAnd you can add config info
then
<Prefix>
X for killing a session我可以确认以下通过 Windows 命令在 ssh 中运行的 tmux 上的工作:
复制:按
shift
,使用鼠标选择,按Ctrl+Shift+C
粘贴:
Shift+右键单击
无需特殊设置。
I can confirm following working on tmux running in ssh via Windows Command:
Copy: Press
shift
, select using mouse, pressCtrl+Shift+C
Paste:
Shift+Right click
No special settings were needed.