Cómo terminar una ventana en tmux?


¿Cómo terminar una ventana en tmux? Como el Ctrlunk acceso directo en pantalla con Ctrlun siendo el prefijo.

 157
Author: Mateusz Piotrowski, 2011-10-14

9 answers

La respuesta de Kent respondió completamente a su pregunta, sin embargo, si está buscando cambiar la configuración de tmux para que sea similar a GNU Screen, aquí hay un tmux.conf que he utilizado para lograr esto:

# 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
 35
Author: Jimmy Zelinskie,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-10-15 04:41:49

Intente Prefix + &

Si tiene

bind q killp

En su .tmux.conf, puede presionar Prefix + q para matar la ventana también, solo si solo hay un panel en esa ventana.

El prefijo predeterminado anterior es Ctrl+b , así que para terminar de ventana por defecto, puede utilizar Ctrl+b &

 264
Author: Kent,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-24 14:44:04

<Prefix> & por matar una ventana

<Prefix> x para matar un panel

Si solo hay un panel (es decir, la ventana no está dividida en varios paneles, <Prefix> x mataría la ventana)

Como siempre se itera, <Prefix> es generalmente CTRL+b. (Creo que para las preguntas de principiante, podemos decir CTRL+b todo el tiempo, y no hablar de prefijo en absoluto, pero de todos modos:))

 71
Author: Rushi Agrawal,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-07 06:34:57

En general:

tmux kill-window -t window-number

Por ejemplo, si estás en la ventana 1 y quieres matar a la ventana 9:

tmux kill-window -t 9
 70
Author: Gary,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-23 15:21:07

Para mí la solución se ve como:

  1. ctrl+b q para mostrar los números del panel.
  2. ctrl+b x para matar a pane.

Matar el último panel matará la ventana.

 34
Author: Nikolay Fominyh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-03-27 12:50:35

Si solo desea hacerlo una vez, sin agregar un acceso directo, siempre puede escribir

<prefix> 
:
kill-window
<enter>
 25
Author: gatoatigrado,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-01-24 14:58:23

Mientras preguntabas cómo matar una ventana resp. pane , a menudo no quisiera matarlo, sino simplemente volverlo a un estado de trabajo (el diseño de los paneles es importante para mí, matar un panel lo destruye, por lo que debo recrearlo); tmux proporciona los comandos respawn para ese efecto: respawn-pane resp. respawn-window. Sólo que la gente como yo puede encontrar esta solución aquí.

 10
Author: Tom Regner,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-03-11 11:26:09

Hay muchas maneras diferentes de hacer esto, pero mi favorita es simplemente escribir 'exit' en el prompt de bash.

 7
Author: smp,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-12-12 16:15:31

ctrl + d mata una ventana en el terminal linux, también funciona en tmux.

Esto es una especie de enfoque.

 1
Author: pingsoli,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-26 09:46:56