15

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?

20

Use the screen quit command (normally ctrl-A \).

  • Ctrl+a Ctrl+-, yields a blank screen, Ctrl+a Ctrl+c yields a new screen, which Ctrl+D then is able to exit like all other screens I've encountered before this. – Walrus the Cat Jan 25 '15 at 0:55
  • 2
    Oops, markdown turned my "ctrl-\" into "ctrl-". Fixed. – aecolley Jan 25 '15 at 1:04
  • 8
    It worked as Ctrl-a \ (that is Ctrl-a and then plain \ without ctrl). Strange that the link provided includes a Ctrl for the \. – niels Jul 4 '16 at 13:06
  • This kind of works, but when connecting to a qemu serial pty this really kills it. That means I can't reconnect to it after that. With picocom, I can easily terminate the serial connection and reconnect later. – maxschlepzig Mar 7 '18 at 15:04
6

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

6

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.

0

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>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.