The terminal accepts and executes a bunch of different character sequences as control commands. For example, all cursor movement is done using those.
Some of the codes make permanent changes, like setting colors, or telling the terminal to use an alternate character set. Executables and other binary files can well contain bytes that represent those commands, so dumping binary files to the terminal can have annoying side effects. See e.g. here for some of the control codes.
The historical background to this is that originally, terminals were rather dumb devices with a screen and a keyboard, and they connected to the actual computer via a serial port. Before that, they were printers with keyboards. There wasn't much of a protocol to separate data bytes from command bytes, so commands were given to the terminal "inline". (Or rather, the escape codes and control characters were the protocol.) One might assume that if the system was devised today, there would be clearer separation between data and commands.
Instead of just closing the terminal window or killing the emulator, you can use the reset
command, which sends a similar command (or several) to reset the terminal back to sane defaults.
I don't know what exactly would cause the hash to pound change. (But @Random832 does, see their answer.) I'm more familiar with the "alternate character set", which can change all characters into line-drawing glyphs. Even if that happens, input from the keyboard usually goes through unchanged, so writing reset
Enter still works even if the characters display as garbage or not at all. (Compared to your prompt being turned into a bunch of lines, you only got a minor effect.)
.bashrc
somewhere? Not by copy+pasting, but as if it were a binary file – 小太郎 Aug 11 '16 at 09:34.bashrc
is not important here. The error came about bycat
ting the/bin/bash
binary (which produced a wonderful soup of characters all over the screen). Thecat .bashrc
is only there to show how even the symbol for line comments has changed. – lhermann Aug 11 '16 at 12:02#
,\x23
; it's just that the terminal now interprets\x23
as£
. – deltab Aug 11 '16 at 13:32postgres=£
instead ofpostgres=#
in a KDE konsole... – David Tonhofer May 01 '19 at 22:42