my cheat sheet on screen (serial console)

Home

1 Linux/Mac/Unix Serial Utility screen

Most *nix systems include screen, a command line utility for accessing serial devices on unix.

2 Listing ttys

Post Mojave, my usb-c adaptor to usb to serial PL2302 h/w adaptor shows up as:

  • /dev/tty.usbserial
  • /dev/cu.usbserial
  • /dev/cu.usbmodem805NTZNAV3252
  • /dev/tty.usbmodem805NTZNAV3252

I don't know if it had anything to do with it or was just coincidence, but I did NOT see any usb devices when I grep -i usb /dev/*.* Then I installed serial-detect app from from https://www.mac-usb-serial.com/

And it could tell when I plugged in my PL2302 h/w adaptor. Only then did I notice the /dev/cu.usbserial and tty.usbserial directory listings in /dev directory.

Update: July 8th, 2019:

  • screen /dev/tty.usbserial 9600 successfully connected my console.

If in the future that fails, I could buy an air console from https://www.get-console.com/shop/en/27-airconsole if they make that anymore.

Update: May 3, 2023 My UART serial to USB converter shows up as /dev/tty.usbserial-0001

3 Using Screen

3.1 Screen keyboard commands

The following key squences are the most important

C-a C-\ To quit the screen app. i.e. type control-A, then control-\

While in screen, use the command sequence "control-a command" or C-a for short. The most important command is C-a ? This will show you all the available commands The one I use most is C-a H which will log the session to a file screenlog.0 in the directory you started screen.


as of July 2018: downloaded PL2303 drivers and installed Now my device is:

  • /dev/tty.Bluetooth-Incoming-Port
  • /dev/tty.Zibensmini-WirelessiAP
  • /dev/tty.usbserial

And when I plugged in a USB-C cable as my direct console into a Cat2960X switch I also saw: /dev/tty.usbmodemC_____1

4 Pre Mojave I did this:

ls /dev/tty.*

This will provide you with a list of all of your serial ports. Pick the one that you want to open. For example, my list looks like this:

  • /dev/tty.Bluetooth-Modem
  • /dev/tty.PL2303-0000103D
  • /dev/tty.Bluetooth-PDA-Sync

I know that /dev/tty.PL2303-0000103D is my IO Gear USB-to-serial adaptor. It's connected to a Cisco 831 at the moment. If your USB-to-Serial cable is not connected to your computer, you will likely not see your device listed. Knowing the serial port, you can just type 'screen portname datarate' to show the serial data on the screen. In my case, it was:

screen /dev/tty.PL2303-0000103D 9600


Summarizing: ls/dev/tty.*; screen /dev/tty.PL2303-0000103 9600 ; control-A ~control-\ to quit

5 help Window

/Users/zintis/eg[39] % screen /dev/tty.usbserial 9600

Swipe left and right to see the full screen below.

 
                                                 Screen key bindings, page 1 of 1.

                                                 Command key:  ^A   Literal ^A:  a

  break       ^B b         focus       ^I           meta        a            readbuf     <            time        ^T t      
  clear       C            hardcopy    h            monitor     M            redisplay   ^L l         title       A         
  colon       :            help        ?            next        ^@ ^N sp n   remove      X            vbell       ^G        
  copy        ^[ [         history     { }          number      N            removebuf   =            version     v         
  detach      ^D d         info        i            only        Q            reset       Z            width       W         
  digraph     ^V           kill        ^K k         other       ^A           screen      ^C c         windows     ^W w      
  displays    *            lastmsg     ^M m         pow_break   B            select      '            wrap        ^R r      
  dumptermcap .            license     ,            pow_detach  D            silence     _            writebuf    >         
  fit         F            lockscreen  ^X x         prev        ^H ^P p ^?   split       S            xoff        ^S s      
  flow        ^F f         log         H            quit        ^\           suspend     ^Z z         xon         ^Q q      

^]  paste .
"   windowlist -b
-   select -
0   select 0
1   select 1
2   select 2
3   select 3
4   select 4
5   select 5
6   select 6
7   select 7
8   select 8
9   select 9
]   paste .

5.1 Home