Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I'm trying to talk to a device using a usb-to-serial converter on linux. Drivers are working, the device exists at /dev/ttyUSB0.

There is a strange problem (checked with a null-modem cable to another computer): Whatever program I use to connect to the device (putty, minicom, screen), they all send a CR (\r) on enter. I (and my device) expect a LF (\n) on enter.

When I use the console to send a command - it sends a LF:

# echo Hello World > /dev/ttyUSB0

Results in "Hello World\n". I also wrote the classic c hello world program (printf("Hello, world!\n");) and redirected the output to /dev/ttyUSB0 - also gives me a "Hello world\n" on the other end of the line.

But all other terminal programs send a \r on enter.

What's going on here?

share|improve this question
Standard TTY protocol is to sent a CR from the keyboard when the user has finished typing and for the computer to echo LF when it's ready for the next line. – Daniel R Hicks Jun 26 '14 at 17:27
Check the current settings of your tty with stty -a. Use stty -ocrnl to change the output behaviour of CR being translated to LF. – ott-- Jan 18 at 16:41

Please ensure you have set the ttyUSBx port in raw mode. Otherwise there can be some character replacements e.g. \r with \n and vice versa on receiver side.

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.