Why is my Terminal typing weird characters?

Linode Staff

When I'm connected to SSH using my Mac's Terminal and use my arrow keys, it prints characters like ^[[C instead of moving the cursor. Why is that and how do I fix it?

2 Replies

That certainly is a strange behavior. The images supplied on our platform use pretty much stock versions of the distributions they provide, aside from a few minor tweaks to make them work better with our platform. There isn't anything in our images that should cause that to happen, but I may have an idea.

Many terminal applications for Mac will replace arrow keys with characters like ^[[A, ^[[C, etc if the Option key (or another modifier key) is being held down. I've had this happen to me a few times. In my own experience this happens when something is pressing down on the key, or if a bluetooth keyboard is connected that could have something sitting on it. In the past, I've found my keyboard in my laptop bag, having been accidentally left on. Alternatively, if there is an issue with the keyboard itself, it could be responsible for what you're seeing. If you have another keyboard I recommend trying that to rule it out. If you're still having trouble, using a different Terminal emulator may help.

It's what's sent from the keyboard. If a script or something is running in the foreground this can happen too when trying to use arrow keys. It's a pretty normal occurrence not speicifc to Linode.

You could try:

Terminal -> Preferences -> Shells open with -> [select] Command (complete path)

then paste

/bin/bash

That potential solution is taken from an answer on stackoverflow that also has more details about this:

https://stackoverflow.com/questions/21384040/why-does-the-terminal-show-a-b-c-d-when-pressing-the-arrow-k

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct