why does `cat' ing a binary file mess up your shell?
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.
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.
Or more specifically the interpretation of stdout :)
can you do harm to pc just using cat on binary file?
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.
Join our real-time social learning platform and learn together with your friends!