Ask your own question, for FREE!
Computer Science 18 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
Graysonunderwoods: Have you even been beaten by a wet spaghetti noodle by your girlfriend because sh
2 minutes ago 48 Replies 1 Medal
AsianPanda08: What should i eat for dinner tonight? I can't choose
1 hour ago 51 Replies 2 Medals
Nina001: Trying 2 figure out what is the square root of 8746685
33 minutes ago 30 Replies 2 Medals
SnowyBreaks: Is it bad to lose 3.8 pounds in less than 2 days?
1 hour ago 43 Replies 0 Medals
kaelynw: tried a lil smt, the arm is off but i like the other stuff
18 minutes ago 15 Replies 2 Medals
laylasnii13: Who wanna write or make a song with me???
5 hours ago 8 Replies 0 Medals
kaelynw: art igg
13 hours ago 13 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!