It helps to read the ssh
manual page:
-T Disable pseudo-tty allocation.
-t Force pseudo-tty allocation. This can be used to execute arbi‐
trary screen-based programs on a remote machine, which can be
very useful, e.g. when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.
When you tell it to allocate a pseudo-tty, any process on the remote side can see that the connection is a "real" terminal, and will send additional messages since the connection is interactive. In your shell initialization, it also is able to setup the terminal modes, which you can inspect using stty -a
. Terminal modes are used to translate between your keyboard entry and the host, and between text sent from the host to your terminal:
- Without initializing, the connection is not a terminal and no translation is done.
- With initializing, the terminal will translate newline (
\n
) to carriage-return and line-feed (0x0d, 0x0a). It also will (for most users) translate tabs to spaces.
The effect described is for translation. Without that, your interactive session would "staircase" across the screen and be unusable.
Your shell may also print additional information, but for a single command, the suggestion by @kba is misleading because the shell normally will not send prompts, and the ssh controls such as ~C
mentioned apply to input rather than output.
When running to a terminal, ssh will also print a message when closing the connection. But that is written to the standard error.
ssh -t
will send additional newlines and react to SSH escape sequences. – kba Feb 18 '16 at 08:38