Using screen for serial connections

Add your user to the dialout group so you don't have to do sudo screen:

$ sudo adduser $USER dialout

Then either reboot, or start a new shell with the new group applied

$ newgrp

Then connect to the TTY with

$ screen /dev/ttyUSB0 115200

Note that the 115200 baud rate is a good default, but is device configuration dependent, so you may need to provide a different value.

There's a few helpful keybinds

You can set the size of the scrollback buffer with screen -h <lines>. The default is 100 lines, but Ubuntu ups that to 1024 lines in /etc/screenrc.

You can set a custom session name with screen -S <session>. But if you're only a passing screen user like me, and only ever have one screen session open at a time, you can use screen -r to resume a detached session. Otherwise, you can use screen -list to list sessions, and screen -r <session> to resume a specific session.

$ screen -list
There is a screen on:
    16366.pts-1.bedlam    (01/17/2023 05:21:36 PM)    (Detached)
1 Socket in /run/screen/S-nots.
$ screen -r 16366.pts-1.bedlam

screen is pretty customizable; there's guaranteed to be more powerful workflows that you can use, but this is all I needed to be productive at a serial console.

An aside on PuTTY

I can't remember the details, but at one point I came to the conclusion that I should use PuTTY for serial connections because it "Just Worked". But when I tried it today, it'd crash because it couldn't load a font

$ putty
(putty:10718): Gtk-CRITICAL **: 16:01:12.674: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
(putty:10718): Gtk-CRITICAL **: 16:01:12.675: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
(putty:10718): Gtk-CRITICAL **: 16:01:12.676: gtk_box_gadget_distribute: assertion 'size >= 0' failed in GtkScrollbar
PuTTY: unable to load font "server:fixed"
$ echo $?
1

If I set the font to something I have installed locally, it works. This seemed suboptimal, so I'm back to screen now that I know how to use the scrollback mode.