I know ^M will show up when ssh -t, ref1, but I don't catch the situation when ssh -t into Centos 7.2(even Centos 6.2 is OK, but no difference between their environment vars). Anyone know about this? Or maybe related to ref2?

$ ssh -t centos72 'echo $HOME' 2>/dev/null|cat -A
$ ssh centos72 'echo $HOME' 2>/dev/null|cat -A
$ ssh -t ubuntu1404 'echo $HOME' 2>/dev/null|cat -A
$ ssh ubuntu1404 'echo $HOME' 2>/dev/null|cat -A

1 Answer 1


These are control characters for your terminal or VT100 codes. They are needed to make your terminal working with the remote psoudoterminal, to show your prompt and other stuff.

Verbose description of the tags from another SO question and from wikipedia:

  • CSI ?25h : Shows the cursor.
  • CSI n G : Moves the cursor to column n. (not ANSI.SYS)
  • CSI n K : Erases part of the line. If n is zero (or missing), clear from cursor to the end of the line. If n is one, clear from cursor to beginning of the line. If n is two, clear entire line. Cursor position does not change.
  • and once more the first two.
  • ^M : Carriage Return (on the end of the line)

These are some basic sanity checks to make sure the terminal is ready. Ubuntu sends them probably only after the query from the local terminal.

  • So, there is no way to disable this except for turning -t off? Why is there differences between CentOS 6.2 and CentOS 7.2?
    – schemacs
    Dec 27, 2015 at 9:58
  • I don't think so. Using -T will disable TTY allocation and therefore the control characters. If you need just the output from command, there is no reason to create remote TTY. To find a difference it would be probably required to have a look into the source code or so. I don't have CentOS machine around here (6.2 is pretty out-dated).
    – Jakuje
    Dec 27, 2015 at 10:03
  • here github.com/ansible/ansible/blob/v1.9.4-1/lib/ansible/runner/… will return invalid temp path, and github.com/ansible/ansible/blob/v1.9.4-1/lib/ansible/runner/… will add -tt when in_data is None .
    – schemacs
    Dec 27, 2015 at 10:40
  • I have filed an issue here: github.com/ansible/ansible/issues/13677
    – schemacs
    Dec 27, 2015 at 11:06
  • It might be even problem in CentOS, but I am wondering that nobody even experienced it. I just booted my RHEL7 and I don't see the problem you describe. It prints me only the ^M, so it will be probably configuration issue. Can you check if this happen even with different users or what is in your startup scripts?
    – Jakuje
    Dec 27, 2015 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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