Sometimes, when I invoke history
in bash, it starts printing normally, and at some point switches to garbled characters:
Oddly, when I copy that from my terminal and paste it here, the characters are different:
19955 ssh somehost-bacc
19956 ssh-keygen -R somehost-bacc
19957 ssh somehost-bacc
19958 ssh otherhost-bacc
19959
19960 __h +_+-+e_+-bacc
19961 d_y +_+-+e_+-bacc
19962 dia+--b _bc+c-_dc-2-c+c
19963 d_y _bc+c-_dc-2-c+c
My prompt and everything are garbled after that, until I reset
.
Looking around in .bash_history in Vim or less, that line shows as ^L^N^U
. I definitely didn't just press Ctrl+LNU at the prompt then.
The first time this happened, I deleted that line, and history
printed normally afterward.
This is the second time it's happened, and I want to know why, and how to avoid it.
Context:
Bash 4.2.46(2)-release on CentOS 7.7.1908
SecureCRT 8.3.4 on Windows 10 1909
stty reset
will fix it. You have sent your terminal ASCII Control Characters including ^N and ^O. See http://ascii-table.com/control-chars.php – waltinator Apr 14 '20 at 23:09