Did a cat /dev/urandom - Broken terminal
Solution 1
Try one of these:
stty sane
or
reset
If both don't work, or your terminal is so messed up that you can't even enter commands, then it is best to close the terminal and start a new one.
Note that stty sane
is defined by POSIX whereas reset
is not. That means on some systems there might not be a reset
or it might do something completely different, like resetting the entire system. I have not yet encountered a system without reset
.
For more background information read "The Linux keyboard and console HOWTO" chapter "Resetting your terminal".
Solution 2
You can try using the reset command.
Solution 3
The reset
command should work.
Related videos on Youtube
Garry White
Updated on September 18, 2022Comments
-
Garry White over 1 year
The changes introduced in CDT 9* (diff link) removes support for
ASTCompletionNode
's of different type thanorg.eclipse.cdt.core.dom.ast.ASTCompletionNode
.If a plugin adds a contribution and inserts completion proposals which implement a different
IASTCompletionNode
, (e.g. theASTCompletionNode
from theorg.eclipse.cdt.core.lrparser
, the following exception is thrown onCtrl + Space
:java.lang.ClassCastException: org.eclipse.cdt.core.dom.lrparser.action.ASTCompletionNode cannot be cast to org.eclipse.cdt.core.dom.ast.ASTCompletionNode at
org.eclipse.cdt.internal.ui.text.contentassist.DOMCompletionProposalComputer.computeCompletionProposals(DOMCompletionProposalComputer.java:165)
What workarround do I have in this situation?
-
We Are All Monica over 10 yearsSure... don't do that! Also, if you think a command might produce invalid characters, use
cat -A
. -
crasic over 10 yearsAdditionally, I've always been curious how
cat
can break your character set... -
skarface over 10 yearscat /bin/ls often fixes this (not sure why)
-
Olivier Dulac over 10 years@crasic : it sends binary to the terminal, and each terminal have ways to change font/color/etc by receiving special caracters. See the marvelous: linusakesson.net/programming/tty (aka "the TTY demystified). Depending on your TERM setting, it will react differently too (and of course, depending what bytes it receives and in what order).
-
Olivier Dulac over 10 years@skarface: you probably got lucky that the binary of /bin/ls had, near the end, byte sequences that fixed the display. It will depend on the OS, the binary (ie, which version, what compile optino used, etc), and the TERM setting of your terminal... so I highly recommend you use "stty sane" instead ^^
-
Olivier Dulac over 10 years@crasic: en.wikipedia.org/wiki/ANSI_escape_code shows examples of those caracters (and, as they say in that very page, "most terminal emulators interpret at least some of the ANSI escape sequences in the output text." (ie, not all term emulators, and not all those codes))
-
Garry White over 5 yearsIn my opinion the cast is not required. The list of
ASTName
's could have been taken directly from theIASTCompletionNode completionNode
parameter:completionNade.getNames()
. -
Jonah Graham over 5 yearsHi Garry, this is a perfectly on topic question for posting on CDT's own mailing list where the CDT devs are. Please join and post your question there. accounts.eclipse.org/mailing-list/cdt-dev (BTW your diff link does not link to a diff, but the current HEAD of that file, I assume the link you meant was github.com/eclipse-cdt/cdt/commit/… )
-
-
Luke404 over 10 yearsYou linked the man page, implicitly recommending a good RTFM. You're my hero today, thanks.
-
Pedro Montoto García over 10 yearsI gave you the right answer because you were the first. Sorry to the other ones.
-
Random832 over 10 yearsIn general, writing random bytes to a terminal is unlikely to put it in a situation that needs stty sane to fix; that's more likely to come from a program crashing.
-
Olivier Dulac over 10 yearsThis works on many unixes... But some word of warning : be careful: on some systems (ie, other OSs, or maybe some other distribution of linux?) this could be initiating a system reset (I believe for example it does on some versions of solaris). Therefore reseting the system, ie forcing a reboot (without proper shutdown)... Like for any command, be careful. (This is true for other commands as well: some 'tar' for example do NOT remove "/" prefixes and therefore can overwrite sensitive files, etc. Always make sure you do know how the command you intend to use work on the system you are using.)
-
Olivier Dulac over 10 years
stty sane
is the safe&proper way (I am weary of "reset" for the reasons I stated in comments underneath lain's answer) -
user9517 over 10 years@OlivierDulac; The OP tagged his question linux so he got a linuxcentric answer although it will work on other unix systems including Solaris without issue. I worked with Solaris for 15 years! You are confusing the SPARC Open Boot Prom reset command with the userland reset(1) command. If you issue the reset at the ok prompt you're unlikely to be recovering from a corrupt terminal though.
-
user9517 over 10 years@OlivierDulac You are plain wrong: You are spreading FUD.
-
Olivier Dulac over 10 years@lain: ah, this could be this (Open Boot prom), indeed. But still, it means on some environment "reset" is linked to resetting the host, so I prefer people (even if they are "mostly" on linux) to learn/use the "safe" "stty sane" command (which states what it does, and is not as ambiguous as "reset")... that's why I am warning readers about this.
-
user9517 over 10 years@OlivierDulac Solaris, CentOS, Ubuntu, OpenBSD all link reset to tset - please provide evidence for your misinformation other than your misremembering something. OBP is not a host OS so it doesn't count.
-
Olivier Dulac over 10 years@lain: Like I said, I prefer people to use the safe one (stty sane) instead of one that, in some environment it may not be doing the "terminal reset". It did happen to me, that's why I wanted to add that warning. I had a garbled putty, issued the "reset" and had the host rebooted... call it FUD? I call this "being prudent, and warning to use caution with some commands".
-
user9517 over 10 years@OlivierDulac Being prudent is reading the documentation; unsubstantiated claims like yours are FUD.
-
Lesmana over 10 years@OlivierDulac Thank you for sharing your experience. I researched and learned that
reset
is not defined by POSIX. -
Lesmana over 10 years@Iain I do not think that @OlivierDulac is spreading FUD. The reference that
reset
is not "safe" is the fact that it is not defined by POSIX. Please stop spreading the FUD that @OlivierDulac is spreading FUD. -
Olivier Dulac over 10 years@lain: why so upset? I am just warning people to prefer 'stty sane' to 'reset' as the later, in some environment, could do something else (up to reseting the system). You pointed out yourself what could have been my experience on solaris, and I acknowledged it: it was probably at openBoot (years ago, details are blurred. But, being new to openboot, and having connected via serial to the machine itself, I expected a "reset" would either fix the display (if already loggued in) or say a garbled "inccorect login/pwd" (if at the login prompt) but it reset the system instead (as I was in the OBP).
-
Olivier Dulac over 10 years@lain: OBP does count. In my experience (see my last reply to the top answer), with a garbled display, I couldn't tell I was at the OBP level instead of in the console or already loggued in. Had I tried "stty sane" the system wouldn't have rebooted (nor been fixed, of course). I will stop replying now, but I wish you wouldn't be so upset when I am just trying to warn people (this is NOT FUD).
-
user9517 over 10 years@OlivierDulac if you had tried stty sane at the OBP it wouldn't have recognised the command. FUD is FUD
-
Olivier Dulac over 10 years@lain: ... and wouldn't have rebooted. My point, exactly.