I'm setting up a console server and I need to determine the correct baud rate of my port. I'd like to do this from the command line, if possible. Does anyone know how?

3 Answers 3


The program you're looking for is called "setserial".


  • 3
    Can you elaborate? E.g. what would an example command line be? Please respond by editing (changing) your answer, not here in comments (without "Edit:", "Update:", or similar - the answer should appear as if it was written today). Sep 27, 2021 at 23:58

setserial is Linux-specific, but you can also use the stty command (available on any Unix) to check the speed and other characteristics of any tty.

stty operates on its standard input, so stty < /dev/ttyXX will give you the information about that particular tty. Alternatively, if you're in a situation where you cannot set the standard input of stty, you can use the -F /dev/ttyXX option.

  • 10
    You may need to use stty -F /dev/ttyXX Oct 25, 2012 at 21:47
  • 1
    Note that this doesn't tell you what a particular serial port should be set to, based on the actual baudrate of the data coming in, rather, it tells you what you currently do have the baudrate set to, which could be the wrong baudrate. Dec 29, 2021 at 19:11

Since you mention a console server and this question is tagged with linux I will assume you are connecting to a linux server. The server must be configured to use a serial console so there are a couple of places to check.

The kernel setup involves adding the "console" parameter to the command line of your kernel. For example adding "console=ttyS0,9600" tells the kernel to send messages to the first serial port (/dev/ttyS0, COM1 in DOS/Windows terms) at 9600 baud. You can add this to the command line through your boot loader configuration. If using grub this will usually be a file called /boot/grub/grub.conf. Note that you can have multiple console parameters for traditional keyboard/video console (tty0) as well as serial (/dev/ttyS0). For exaxmple: "console=tty0 console=ttyS0,9600"

To provide a login prompt via serial you need to edit /etc/inittab and add/edit a line like the following. s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100 This line tells the agetty program to spawn a login prompt on /dev/ttyS0 at 9600 baud.

Note you will normally want to match the serial port and baud rate between the kernel and agetty setup. By checking the configurations above you should be able to determine the server baud rate.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .