Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After having played with curl, a binary file has been dumped inside my terminal. For example, the horizontal lines: ─ I use to format my prompt are replaced by 'q', and it can be much worse.

Why does this happen, and how can you fix it without having to close the terminal ?

share|improve this question
up vote 22 down vote accepted

I think reset would definitely fix it.

Consider looking into man page.


[m0nhawk@terra:~]> cat /dev/urandom
[└█┼░▒┬┐@├err▒:·]> c▒├ /de┴/┤r▒┼do└

And resetfixes this.

share|improve this answer
Worth to mention, if you run cat /dev/urandom, abort with Ctrl-C. Also, @Antoine, you could examine clear. I know you said "terminal", but, in the Linux console, there is (besides clear and reset) clear_console as well. – Emanuel Berg Oct 13 '12 at 13:24
In some cases, reset has been known not to solve this. echo -e '\017' can help there. – Alexios Oct 13 '12 at 15:53
"some cases" basically refers to those where the terminal description is incorrect. – Thomas Dickey Feb 22 at 10:09

Typing the command stty sane should fix it.

share|improve this answer

Best solution I've found is:

echo <ctrl-v><esc>c<enter>

I alias this to "unbinary"

share|improve this answer
For a terminal emulator, sure. But a full reset on a hardware terminal (or serial connection) is a little drastic (you would have to log in again). – Thomas Dickey Feb 22 at 10:11

See this post for a more through reply of the different reset methods you can use: Fix terminal after displaying a binary file

share|improve this answer
That posting was written later and provides no improvements. It should have been marked as a duplicate. – Thomas Dickey Feb 22 at 10:12
@ThomasDickey Somehow this duplicate generates more traffic. Maybe its wording is better than mine. Do we know which term (in search engine) they used to find this other one ? – alecail Feb 22 at 12:07
There's more words in the other (google likes words), and is not really more thorough, since there is no discussion in either of the reasons why the behavior occurs, nor of the reasons why one solution works or does not work. – Thomas Dickey Feb 22 at 22:25
@AntoineLecaille The duplicate generates more traffic because of the accepted answer that it contains: The answer here is functional but sparse. What should you do if you can not see the cursor? which alternatives should you try if reset does not fix it? That duplicate's answer is verbose with step by step instructions. Ok, perhaps verbose does not do it for everyone, but it does seem to be generating more upvote clicks. In any case, it is my prefered answer. However, there is certainly room for both. Those preferring concise can upvote this one, instead. Freedom to choose. – Vassilis Papanikolaou Feb 23 at 8:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.