Image of the glider from the Game of Life by John Conway
Skip to content

Connecting To Serial Null Modems With GNU Screen

The motivation for this post, actually, is that I had heard of the BSD-licensed tmux. I've heard it's far more configurable than GNU screen and lighter on resources. So, I thought I'd install it on my Debian machine, and give it a quick test drive. The first thing I wanted to test, was not attaching and detaching sessions, but using tmux to connect to serial ports as a null modem. I use this feature with GNU screen all the time, as I'm constantly in the back of Cisco switches, HPUX ports, and other serial connections in our datacenter at work. However, I found out very quickly that tmux doesn't support this feature. In fact, the developers call it "bloat" (emphasis mine):

There are still a few features screen includes that tmux omits:

- builtin serial and telnet support; this is bloat and is unlikely to be added to tmux;
- wider platform support, for example IRIX and HP-UX, and for odd terminals.

That's unfortunate. I've found that when developers call a requested feature "bloat", it's usually because they don't use it themselves. That may be the case here. I don't know. However, I do know that GNU screen supports both serial and telnet connections, and it's a valued feature for our team.

So, here's how you can use GNU screen to act as a terminal emulator to a serial null modem connection. Just start a screen session on the correct serial device:

$ screen /dev/ttyS0

If the connection is too slow, and your serial port can handle faster baud rates, then you can set that instead:

$ screen /dev/ttyS0 115200

As is common with null modem connections, if you need to send a break, just send C-a B.

That's it. Rather straight forward. I know that using minicom or HyperTerminal can sometimes be a pain, so using a more modern terminal, complete with telnet, multiuser, locking and splitting support can make all the difference in the world. So, why tmux won't support this is beyond me, but it sure makes life behind the serial connection just a bit more enjoyable, and a valuable system administration tool.

{ 9 } Comments

  1. Kevin using Firefox 3.5.8 on Ubuntu | March 23, 2010 at 6:37 pm | Permalink

    Sweet! I didn't know screen could do that.

  2. Robert Wall using Debian IceWeasel 3.5.8 on GNU/Linux | March 23, 2010 at 9:29 pm | Permalink

    I love this feature of screen :). I used it to connect to the serial console on my SheevaPlug when I was setting it up. Entertainingly, comparable functionality on Windows is a pain in the ass: the Internet recommended PuTTY, which isn't anywhere near as easy to set up, and didn't actually work at all for me.

  3. Alex using Google Chrome 4.1.249.1036 on Windows 7 | March 23, 2010 at 11:18 pm | Permalink

    I found it amusing that you wanted to use something that was lighter on resources, and immediately went on to note that it was lacking in features that the developers considered 'bloat.' It's just a perfect example of the CW idea that 90% of users use only 10% of the features in a given program, but the chosen features differ from person to person.

    Oh, and tmux looks cool. I may try it out.

  4. Aaron using Google Chrome 5.0.356.2 on GNU/Linux 64 bits | March 24, 2010 at 12:00 am | Permalink

    @Alex- Honestly, I wouldn't think of serial connections as any sort of advanced or highly technical feature in tmux that would be missing. I installed it, then went to work. First on the list was connecting to a SAN via serial to setup the IP addresses, etc. I thought tmux would be a good fit, and after fiddling for a bit, I found that the developers aren't interested in building that feature. So, being a bit frustrated for wasting time, I went back to GNU screen, and got my work done.

    To each their own, I guess, but I would put serial connections with a terminal multiplexer right up there with ftp support in a web browser.

  5. Garry Parker using Firefox 3.6.2 on Windows XP | March 25, 2010 at 4:28 pm | Permalink

    Could screen be used to connect from a Linux laptop to the serial port of a DOS box using a null modem cable?

  6. Bee S. Dee using WebKit 531.21.8 on Mac OS | March 28, 2010 at 8:50 am | Permalink

    I use cu and tip inside tmux regularly, and I can't image how built-in serial support would have any impact on the user experience. I must confess though, that I have never used screen's built-in serial support. ( will try this tomorrow )

  7. mitch using Google Chrome 15.0.874.121 on GNU/Linux 64 bits | December 14, 2011 at 1:56 pm | Permalink

    I'm with you on this one. Connecting to a serial console is definitely not bloat!

  8. tissit using Firefox 4.0.1 on GNU/Linux 64 bits | July 4, 2012 at 4:35 am | Permalink

    This is the most useful use for screen these days, since you aren't stuck in a windos box with a single terminal connection as your only useful tool any more. I used to use cu, too, but it is too tied to uucp and in many places (like Debian) broken and long since abandoned.

  9. Eugene using Firefox 21.0 on Windows XP | June 13, 2013 at 4:53 am | Permalink

    This is also good.
    The software works well, Ammyy Admin doesn't require installation or specific config, works behind gateways NAT as well as within one LAN.

{ 4 } Trackbacks

  1. [...] Aaron Toponce : Connecting To Serial Null Modems With GNU Screen [...]

  2. [...] BlogsRelated Blogs on ConnectingAaron Toponce : Connecting To Serial Null Modems With GNU ScreenPurgatory DallasRelated Blogs on FirstLounges, Nightclubs, BarsRelated Blogs on [...]

  3. [...] This post was mentioned on Twitter by blogs of the world, Erik . Erik said: Apparently, gnu screen connects to serial devices as well. Neat! http://pthree.org/?p=1332 [...]

  4. [...] Connecting To Serial Null Modems With GNU Screen [...]

Post a Comment

Your email is never published nor shared.

Switch to our mobile site