Ask your own question, for FREE!
Computer Science 39 Online
OpenStudy (anonymous):

why does `cat' ing a binary file mess up your shell?

OpenStudy (shadowfiend):

Shells are fundamentally based on characters. Everything you type translates to a string of characters. So backspace for a shell translates to a set of bytes sent that are interpreted before they hit the screen. When you cat a binary file, the shell sees all the characters from the file, and will probably run across a bunch of control codes that change a variety of things about the shell's mode. If you get unlucky on the contents of the file, you can end up with a totally hosed terminal.

OpenStudy (rsmith6559):

A binary file can have any value of a byte. Check all the values against a table of Extended ASCII values, and you can see some very interesting possibilities. BTW, I'm not sure the shell is messed up, but stdout sure is.

OpenStudy (shadowfiend):

Or more specifically the interpretation of stdout :)

OpenStudy (anonymous):

can you do harm to pc just using cat on binary file?

OpenStudy (rsmith6559):

I seriously doubt that anything permanent can be done. However, it is a good habit (especially when I remember to do it) to run the file command on any file that you're thinking of looking at.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Shrade3: Chemisty please, annoying
1 hour ago 4 Replies 0 Medals
girlypop: how do I save money more?
1 hour ago 8 Replies 3 Medals
girlypop: how do I find perimeter for a square. I'm actually clueless -_-
3 hours ago 4 Replies 3 Medals
Sarahwells: Define bananaed
1 day ago 6 Replies 1 Medal
breiadabrattzz: How do you stop having anxiety?
3 hours ago 91 Replies 14 Medals
Notliderisahuman: what the best comic book character to draw?
2 hours ago 14 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!