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.