I need to do router or network switch configuration via a console port such as COM1 (ttyS0 under Linux). How do I use the screen command for a serial terminal emulator network with different baud rates under UNIX or Linux operating systems?
Screen command provides different window types. The first parameter to the screen command defines which type of window is created. If a tty name (e.g. “/dev/ttyS0”) is specified as the first parameter to the screen command, then the window is directly connected to this device. An optional parameter is allowed consisting of a comma separated list of flags in the notation as follows:
screen /dev/ttySX baud_rate,cs8|cs7,ixon|-ixon,ixoff|-ixoff,istrip|-istrip
- /dev/ttySX: Linux serial port (e.g., /dev/ttyS0 [COM1] )
- baud_rate: Usually 300, 1200, 9600 or 19200. This affects transmission as well as receive speed.
- cs8 or cs7: Specify the transmission of eight (or seven) bits per byte.
- ixon or -ixon: Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data.
- ixoff or -ixoff: Enables (or disables) software flow-control for receiving data.
- istrip or -istrip: Clear (or keep) the eight bit in each received byte.
In this example, I’m connecting to my Soekris based embedded router using /dev/ttyS0 with 19200 baud rate and cs8:
$ screen /dev/ttyS0 19200,cs8
How Do I See My Serial Port Status and Info?
Simply type CTRL + A + i
How Do I Exit From the Screen Session?
To close the screen session after you finish the router / switch configuration, press CTRL + A + k. To kill all screen session press CTRL + A + . See our quick screen command tutorial for more information.
- See how to install and use minicom which is a communication program that runs under most unices.
- How to setup a serial console under Debian, FreeBSD or OpenBSD.