A U-Bend In The Tubes

Wednesday, July 1, 2009

Fixing Linux terminals after ‘cat’-ing a binary file

Not really a development thing, but whatever…

Everyone who uses Linux on the command line will hit this one at one point or another – You ‘cat’ something, discover it’s a binary file, then discover it’s completely fucked your terminal, thus:

screwedbinaryterminal

Not so very long ago I used to close and restart the terminal, for I am very, very lazy. Then I discovered what the fix was because I am awesome.

There are two solutions to this problem:

1. Use the ‘reset” shell command

% reset [return]

OR

2. Issue the following set of commands (working blind)

% cat [return]
% [ctrl o] [return]
% [ctrl d] [return]

Shazzam:

fixedbinaryterminal
Just for the record, if you feel like breaking it again, run the same set of commands listed above, replacing Ctrl-o with Ctrl-n

posted by Bradshaw at 11:14  

No Comments

No comments yet.

RSS feed for comments on this post. TrackBack URI

Sorry, the comment form is closed at this time.

Powered by WordPress