Based on what I have read, when a terminal is in raw mode, the characters are not processed by the terminal driver, but are sent straight through.

I set the terminal in raw mode using the command stty raw, and I noticed that the output is indented to the right each time until there is no more room. This is what I mean:

enter image description here

Why is this behavior happening?!

1 Answer 1


One of the stty settings (onlcr) tells the terminal driver to convert newline (which is actually ASCII line-feed) to carriage-return plus line-feed.

Unix-like systems just write a newline to end lines, letting the terminal driver do the right thing (convert newline to carriage-return plus line-feed).

Carriage-return "goes left" and line-feed "goes down".

When you set the terminal to raw mode, newline will no longer be converted to carriage-return plus line-feed. Lacking the carriage-returns, you get that staircase effect.

  • and for a in-depth view, you can have a look at @stéphane-chazelas really good post: unix.stackexchange.com/questions/151916/… , which shows a lot of interresting things about terminal conversions (and their side effects). In a nutshell: only "ssh -t" to use interactive commands, but in your scripts use just ssh if you want to get the exact thing the command generated (ex: tar files created on one side of an ssh and read/written on the other side: don't add "-t" or it could (...will?) mess up your binaries ) May 22, 2017 at 15:52

You must log in to answer this question.

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