Serial Networking Devices  «Prev  Next»

Using setserial Command

Use the setserial command to query the characteristics of a serial device. As you have seen, the command is easy to use.
You simply enter setserial followed by the device name.
How do I check and configure serial ports under Linux for various purposes such as modem, connecting null modems or connect a dumb terminal?
Linux offers various tools. Linux uses ttySx for a serial port device name. For example, COM1 (DOS/Windows name) is ttyS0, COM2 is ttyS1 and so on.

Task: Display Detected System's Serial Support
Simple run dmesg command
$ dmesg | grep tty

[   37.531286] serial8250: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[   37.531841] 00:0b: ttyS0 at I/O 0x3f8 (irq = 4) is a 16550A
[   37.532138] 0000:04:00.3: ttyS1 at I/O 0x1020 (irq = 18) is a 16550A

Red Hat Reference

How do I use the setserial command in Linux

The setserial command is used in Linux to configure and query the serial port settings of a computer. The command is typically used in conjunction with a device file that represents the serial port, such as /dev/ttyS0.
Here are some examples of how setserial can be used:
  1. To display the current settings of a serial port:
    setserial /dev/ttyS0
  2. To change the baud rate of a serial port:
    setserial /dev/ttyS0 baud_base 921600
  3. To set the data bits, stop bits, and parity of a serial port:
    setserial /dev/ttyS0 cs8 -parenb -cstopb
  4. To enable or disable hardware flow control:
    setserial /dev/ttyS0 crtscts on
  5. To enable or disable software flow control:
    To enable or disable software flow control:

It is important to note that this command requires administrator level permission to execute, for this reason you need to prefix with

Please refer to man setserial for full documentation and other options available.