What is the cause of this behavior?

$ cd ../
$ bash: $'\210\210cd': command not found

This happens sometimes (rarely) when I enter a command, there is no visible character preceding the cd, still it appears there are.

Am I simply somehow hitting keys on the keyboard I'm not aware of? Or is there a different cause of this?

GNU bash, version 4.3.33(1)-release (x86_64-pc-linux-gnu)

  • 4
    No - that's a bug in bash. Those \210\210 characters you see really are stray garbage. There's a memory leak in bash somewhere (maybe in its $IFS breakup routines, or - given the conditions you name - more likely in its command search routines) in which it winds up leaking internally delimited strings to output. If you watch what bash does in ltrace you'll see it tends to strcmp() just about every command you enter against a \201...\210 delimiter string - looking for the tail of a word. Possibly your terminal is feeding it nulls and it doesn't know how to cope. – mikeserv May 31 '15 at 5:02
  • Indeed there's a chance that this is a bug in bash itself. Can you reproduce this without a .bashrc (run bash --norc)? Can you reproduce this without a .inputrc? What is the content of your .inputrc? What character encoding do you use (output of locale | grep LC_CTYPE? If you encounter the bug, and press Up and Enter to run the command again, do you get the same message? – Gilles May 31 '15 at 19:03
  • Sometimes when I hit <esc> and then a key, I get funny invisible characters, perhaps you did that. – Kevin May 31 '15 at 19:13
  • Gilles: I have no way of deterministically reproducing the issue. Hence I would need to simply run a terminal like that and wait. Sometimes I can use a terminal for a day without producing the issue. My .inputrc is empty and I use en_US. If I press up and enter I do indeed get the same error/message. Also when I press up, I noticed that there is now a difference -- it eats up a character to the left, i.e. "$ cd" becomes "$cd". – AttributedTensorField May 31 '15 at 19:28

Your Answer

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

Browse other questions tagged or ask your own question.