BASH: �ls: command not found when typing ‘ñ’ by mistake

bashcommand lineshellUbuntu

When I erroneously type 'ñ' (expecting to type any command) and then remove it and type the correct letter, the output returns the command with a special character attached , obviously the shell don't recognize the command and I must re-type it being careful not to type again the 'ñ' character.

e.g.

Wrong typing       @tachomi:~$ ñs
Correct typing     @tachomi:~$ ls
Output             �ls: command not found
  • Why is this happening since I removed the wrong character?
  • How can I solve this?

What I think is that this kind of characters ñ , ' etc are not compatible with the shell being this the reason that the "memory" keeps something that it doesn't recognize, but I want to be sure why is this happening.

I'm using bash shell

Best Answer

You have a terminal (or terminal emulator) which understands multibyte encodings (probably UTF-8), but a shell which doesn't. Try setting the environment variable LANG to C.UTF-8. Or run locale -a to find another likely value to try.

Related Question