0

When I ssh into a particular server, I get a weird prefix that looks like a box with the characters 001B, and a "k" behind the vertical "0B". See the picture below.

enter image description here

How do I fix this?

I think it must be a setting in a bashrc or bash_profile somewhere

Caleb
  • 157
  • This is yet another variant on https://unix.stackexchange.com/questions/418157/ , https://unix.stackexchange.com/questions/248299/ , and others. – JdeBP Mar 07 '18 at 21:19

1 Answers1

3

0x001b is hexadecimal for the escape ASCII sequence. Your prompt contains one or several escape sequences that the terminal can not display. Make sure that your TERM variable is set correctly, or set a more sane primary prompt (PS1) in you shell startup script (probably ~/.bashrc if you're using bash).

Kusalananda
  • 333,661
  • Thank you. The TERM variable was indeed the problem. For some reason it seems that "screen-256color" doesn't play nice with ssh. Are there any work-arounds? I like the coloring when I am not ssh'ing. – Caleb Mar 07 '18 at 14:47
  • screen-256color is meant to be used in screen (GNU Screen). If you're not using screen, and you have a terminal that supports 256 colors, you could try xterm-256color, and if that looks weird too, you could try xterm-color. If your terminal isn't xterm-compatible, and you still want colors, you may be able to use the terminal definition for ansi (export TERM=ansi) – Tim Kennedy Mar 07 '18 at 14:51
  • 1
    setting TERM=xterm-256color fixes the issue, as well as TERM=ansi. Both fixes work – Caleb Mar 07 '18 at 14:55
  • @RDev toe -a (on Ubuntu at least) will list all supported terminals. Pick one that most closely resembles the one you are using. TimKennedy's suggestions seems sound to me. – Kusalananda Mar 07 '18 at 14:55