Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I set the baud speed for a specific tty (in this case a serial port)? I tried using

stty -F /dev/tty.iap ispeed 19200

But get the error Invalid argument for every speed I try (2400, 4800, etc.) except 9600 (the default). I can successfully change the speed in a C program using cfsetspeed. Do I need to make a change somewhere else, like the ttys file?

share|improve this question
Why the iphone tag? are you really using iPhone? – enzotib May 5 '12 at 13:41
well actually a jailbroken ipod touch, basically the same. (iap is ipod access protocol.) I figured this question would fit here better than the apple stackexchange site. It is a Unix/Linux question, have the same problem on my mac. – newenglander May 5 '12 at 14:17
Try just leaving out the "ispeed" word. – Keith May 5 '12 at 21:19
@Keith, then I don't get an error message, but I run stty -F /dev/tty.iap to get details, it still says speed 9600 baud;. – newenglander May 5 '12 at 22:26
1) «I can successfully change the speed in a C program using cfsetspeed» — have you verified it with stty then? 2) «like the ttys file?» ­— what ttys file exactly? :) – poige Oct 11 '12 at 21:47

I use the command stty -F /dev/ttyUSB0 9600.

share|improve this answer

I use screen for this purpose

# screen /dev/ttyUSB0 38400

works like a charm

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.