5

I use screen to connect to devices via RS232 with a USB-serial dongle. Currently, I use this command to invoke screen (where 115200 is my baud-rate):

screen /dev/ttyUSB0 115200

Usually, I have more than one device (/dev/ttyUSB0 and /dev/ttyUSB1). Sometimes their baud-rate differs. Currently, I open a new terminal emulator and run screen for each instance, but that kind of defeats the purpose of screen. Can I access both devices in a single instance of screen?

I'm thinking this would involve launching screen with no arguments and then attaching the session to a TTY with a specified baud-rate after it is created, but I don't see a command to change TTYs within a session. I know tmux can do that, but I'd rather stick with screen.

3

Once you've launched screen, you can use its internal screen command to attach windows to additional terminal devices. Type C-a: to get the prompt, then use

screen /dev/ttyUSB1 ######

where ###### is this device's baud-rate. You can also put these commands in your .screenrc to attach the devices automatically when you start screen, or you could bind a keystroke to this command to get a shortcut.

See the Window Types section of the screen manual.

  • doesn't that spawn an instance of screen within screen? – Woodrow Barlow Jan 27 '17 at 22:04
  • No, it's just the command to open a new window. It's the same as the C-a c command. – Barmar Jan 27 '17 at 22:24

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.