Reputation: 4060
Usually CTRL-C
or CTRL-D
quits a program. However, once in a while instead of quitting the program, pressing CTRL-C
just escapes the characters and outputs it to the terminal screen. I've seen this happen multiple times before for different programs: Django, ssh, etc. I've noticed this happens when I've left the terminal for a long period of time.
CTRL-C
behavior back to what I would expect? Here is an example output of what I mean by escaped CTRL-C
and other characters:
^C^C^D^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^D^D^D^D^D^D^D^D^D^D^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^D^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^D^D^D^D^D^D^D^D^D^D^D^D^D^D^[^[^D^D^D^D^Z^Z^Z^Z^Z^Z
Upvotes: 1
Views: 156
Reputation: 146510
This is because the connection to server may have been broken, so your terminal is just echoing what you do instead of being able to show you what the command or the server was responding. The way to get out of ssh in such is to use termination sequence ~ + . + Enter
. Enter may not be always required
Below are the list of SSH escape sequences
~. - terminate connection (and any multiplexed sessions)
~B - send a BREAK to the remote system
~C - open a command line
~R - Request rekey (SSH protocol 2 only)
~^Z - suspend ssh
~# - list forwarded connections
~& - background ssh (when waiting for connections to terminate)
~? - this message
~~ - send the escape character by typing it twice
PS: Taken from https://lonesysadmin.net/2011/11/08/ssh-escape-sequences-aka-kill-dead-ssh-sessions/
Upvotes: 2