Screen Command: Set Baud Rate [ Terminal Communication ]

I need to create 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, 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 Command: Set Baud Rate

The syntax is:
screen /dev/ttySX baud_rate,cs8|cs7,ixon|-ixon,ixoff|-ixoff,istrip|-istrip
screen /dev/{console_port} 115200


  • /dev/ttySX: Linux serial port (e.g., /dev/ttyS0 [COM1] )
  • baud_rate: Usually 300, 1200, 9600 (default), 19200, or 115200. 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.

How to list serial ports under Linux

We use the dmesg command as follows:
$ dmesg | grep tty ## use grep command/egrep command as filter ##
$ sudo setserial -g /dev/ttyS[0123]

/dev/ttyS0, UART: 16550A, Port: 0x03f8, IRQ: 4
/dev/ttyS1, UART: 16550A, Port: 0x02f8, IRQ: 3
/dev/ttyS2, UART: unknown, Port: 0x03e8, IRQ: 4
/dev/ttyS3, UART: unknown, Port: 0x02e8, IRQ: 3

Installing screen

Before we can use screen to connect to the serial console install it as per your version of Linux/Unix system:
## Debian/Ubuntu use apt command/apt-get command: ##
$ sudo apt install screen
## RHEL/CentOS/Oracle Linux users use the yum command ##
$ sudo yum install screen
## Fedora Linux users try the dnf command ##
$ sudo dnf install screen

Setting up baud rate with screen command on Linux or Unix

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
Sample outputs:

Fig.01: Screen command in action

Fig.01: Screen command in action

Using screen to connect to the serial console with 300 baud rate

We set a differnet baud rate as follows:
$ creen /dev/ttyS1 300

How Do I See My Serial Port Status and Info?

Simply type CTRL + A + i

Fig.02: Getting terminal info

Fig.02: Getting terminal info

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.


You learned how to use screen command to set up baud rate and other settings for serial communication with routers and other devices. See

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 2 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
2 comments… add one
  • Reza Aug 25, 2020 @ 22:56

    Great quick article, to the point. Used it as a reference. Thank you.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum