In screen
there is a kill
command, which kills the current window. This command can be sent even to a detached screen
session by running:
screen -S SessionName -X kill
This works to kill the current window only. To kill any other window, it appears the only way is to first switch to that window and then kill it. The select
command allows switching between windows in a screen
session. Typing the following while attached to a screen
session will select the window named foo
.
^A:select foo
However, when not attached to the session, it appears the select
command has no effect. Running the following two commands will kill the current window, rather than the window named foo
(unless of course that is the active window).
screen -S SessionName -X select foo
screen -S SessionName -X kill
I have verified that this occurs even if I attach and detach from the session before attempting to select a window (a known workaround for some other screen quirks).
"select foo"
? – Celada Aug 31 '15 at 03:28"-X select foo"
produces an error (expected).-X "select foo"
produces no effect.-X select "foo"
produces no effect. – Huckle Aug 31 '15 at 03:31