How to determine the baud rate of a serial port?

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?


Solution 1:

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

http://linux.die.net/man/8/setserial

Solution 2:

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.