I am using screen /dev/tty-MyDevice
to look at traffic on my serial port.
Pressing Ctrl+D does not cause the screen to terminate.
What I have to do in order to terminate it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityUse the screen quit command (normally ctrl-A \).
CTRL-A
k
y
Is better because it doesn't "quit" all of screen, just "kills" the current tab, which may or may not be the last tab.
Aug 31, 2021 at 18:53
I run all my terminals inside a screen, and also sometimes use screen to connect to serial. If you screen /dev/ttyUSB0
inside screen, you'll just get a new window in your current session, not a new child screen.
In this case, press Ctrl-A k
to kill only the current window rather than the entire screen process and your other windows with it. This is the kill window command.
Though aecolley's answer usually works then it did not work for me (could be because of Icelandic keyboard and Icelandic locale, but somehow doubt it). When in that situation then you can go to a different console and execute screen -ls
and take note of the screen session number, the output should be something like this:
There is a screen on:
6254.tty2.hostname (Attached)
1 Socket in /var/run/screen/S-root
The screen session number her is then 6254.
Then you can issue the following command to close that screen session: screen -X -S 6254 quit
For me the issue turned out to be that I had inadvertently logged out of the Linux user account, and not the system I was controlling through the serial port. Once I logged back in, all of the normal screen
commands such as Ctrl+a, k began working again.
Beyond that, if you can open a new screen
window (Ctrl+a, c), another TTY (Ctrl+Alt+F1..12, or an SSH session, then you can run pkill screen
or kill <PID of screen>
.