BASH command not found strang behavior

Hi all
I am relatively new to linux (specifically red hat). I have installed Fedora 13 on my machine and started playing with the terminal when i found a very strange behavior when typing a command that is not found:
the terminal does not prompt me back. In other words, i am logged as root (or any user) and type "bla bla bla" the bash replies "command not found" but the cursor stays besides "command not found" and does not display the prompt $(the PS1). Moreover, whatever i type in this strange phase goes without any response, be it a real command (like exit) or any garbage. This phase only ends when i press control+c.
Strange enough, when i type control-z it gives me what i typed (the grabage) and a job number and informs me that the job is stopped (as if a typed a real command that takes a lot of time to run and i am suspending it).
This behavior only happens in BASH, for when i switch to sh nothing of this happens.
Does anybody have any clue why does BASH behave like this? it is a fresh install by the way, haven't changed any parameters or settings.

Thanks

try typing

reset <hit enter>

Then echo $PS1 and $PS2 and see what the values are

You may also want to check environment variables.

1 Like

This might happen when you type an invalid command sequence with an accidental & in it. & has a special meaning to the shell, telling it to run the command in the background. An & in a weird place will cause it to try to put part of the command into background execution, and run everything after the & separately, causing something that looks very strange. I sometimes cause that when I forget to quote a URL.

$ wget www.url.com/param1=arg1&param2
[1] 25175
-bash: param2: command not found
$ --2011-01-18 08:54:04--  http://www.url.com/param1=arg1
Resolving www.url.com... 174.129.241.215
Connecting to www.url.com|174.129.241.215|:80... connected.
HTTP request sent, awaiting response... 404 Not Found
2011-01-18 08:54:04 ERROR 404: Not Found.

Note that the prompt actually does appear, immediately after 'command not found', but gets mangled afterwards by the accidentally-backgrounded wget process printing junk on top of it.

It could also be that you forgot a closing quote somewhere and it's waiting for you to finish your string.

$ echo "words words fleed bargl hey
>
>
> exit
>
> reset
>
> eat flaming death
>
> ^C
$

It would be helpful to know what you actually typed, word for word, letter for letter, keystroke for keystroke.

Thanks alot mark54g. The reset command worked and the strange behavior is gone now. But i wonder why did that happen and the first place, and what does the reset command do?

Thanks again and have a nice day

'reset' resets your terminal characteristics to normal.

You must have run something that dumped a bunch of non-ASCII characters into the terminal. Some of which your terminal coincidentally managed to understand as escape sequences, mashing random settings in your terminal(colors, font settings, scrolling regions, etc) until it was unable to show proper output anymore.