Why Does Piping Binary Text to the Screen often Horck a Terminal

Posted by Alan Storm on Stack Overflow See other posts from Stack Overflow or by Alan Storm
Published on 2010-04-12T18:54:23Z Indexed on 2010/04/12 19:03 UTC
Read the original article Hit count: 295

Filed under:
|
|
|
|

Imaginary Situation: You’ve used mysqldump to create a backup of a mysql database. This database has columns that are blobs. That means your “text” dump files contains both strings and binary data (binary data stored as strings?)

If you cat this file to the screen

$ cat dump.mysql

you’ll often get unexpected results. The terminal will start beeping, and then the output finishes scrolling by you’ll often have garbage chacters entered on your terminal as through you’d typed them, and sometimes your prompts and anything you type will be garbage characters.

Why does this happen? Put another way, I think I’m looking for an overview of what’s actually happening when you store binary strings into a file, and when you cat those files, and when the results of the cat are reported to the terminal, and any other steps I’m missing.

© Stack Overflow or respective owner

Related posts about unix

Related posts about shell