On Sunday 07 May 2006 12:50, Brandon Peirce wrote: > On Tue, 2 May 2006 15:50:18 +0200, Allard Welter <deleted in body> wrote: > >Does anyone know how to get a (console) terminal to reset by itself > >after accidentally cat'ing a binary file. I do this regularly and > > have gotten used to issuing a 'setterm -reset' in binary font. It > > would please me though if did not have to do this each time. > > It's usually better to avoid dumping a binary file to the terminal > than to clean up the result ;-) > I'm not sure if you are doing this because of carelessness (aka > "going too fast!") > or because you're not sure of the tools to use. Here are a few tips: > * To avoid the problem you describe, I have got into the habit of > checking unknown files > with file(1) before trying to display them. > * If it is binary and you want to search for text, try the strings(1) > command from binutils package. > * Less(1) is also safe for displaying binary files as long as you > don't use the -r option.
Thanks, but it's sloppiness on my part. I do it with heads and tails as well sometimes. > Still, despite all the above, sometimes shit happens. > In that case `setterm -reset' is the correct solution. You might be > interested to add the something like this to your .bashrc file: > alias rt='setterm -reset' > Then you can recover your teminal with 3 keystrokes: <r> <t> <Enter> It doesn't happen that often, perhaps I exaggerated a bit. A couple of times per year maybe. It still irritates me though. The reason I asked is because an xterm resets itself (or doesn't get its fonts through the same mechanism as a console) so I was wondering what happens differently. aliases are for things that happen daily. Doing the 'wrong' things is for the rest of my life. Cheers, Allard. PS. I use a valid email address so that I get notified if my message has been blocked or something similar. Having it quoted in the body of the message was not really what I had in mind. -- http://linuxfromscratch.org/mailman/listinfo/lfs-chat FAQ: http://www.linuxfromscratch.org/faq/ Unsubscribe: See the above information page
