Ask your own question, for FREE!
Computer Science 8 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
XShawtyX: Art, Short Writing Assignment: Imagining Landscapes
6 hours ago 2 Replies 0 Medals
XShawtyX: Chemistry, Help ud83dude4fud83cudffe
7 hours ago 13 Replies 1 Medal
kaelynw: tried a lil smt, the arm is off but i like the other stuff
17 hours ago 27 Replies 3 Medals
kaelynw: art igg
16 hours ago 14 Replies 2 Medals
XShawtyX: Art
3 days ago 6 Replies 0 Medals
Nina001: teach me how to draw or just tell me the basics
3 days ago 2 Replies 1 Medal
XShawtyX: We doing another drawing gimme ideas to add to this
3 days ago 9 Replies 1 Medal
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!