LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Bug - All fonts in console become garbled after using cat on a gzip-compressed file? (http://www.linuxquestions.org/questions/slackware-14/bug-all-fonts-in-console-become-garbled-after-using-cat-on-a-gzip-compressed-file-4175466750/)

digitalyuki 06-20-2013 10:07 AM

Bug - All fonts in console become garbled after using cat on a gzip-compressed file?
 
Hi all,

I've dabbled with Linux in the past, but recently I'm undertaking a more comprehensive-like Linux education, and decided to install Slackware (14) on a 2008-era eee PC (1000HE to be exact, retrofitted with a 60GB OCZ SSD and 2GB RAM).

While doing a few n00b linux tutorials, I ran into a weird bug.... when I gzip compressed a text file (ex: "gzip text.txt"), and then subsequently ran a 'cat' command on that compressed file (ex. "cat text.txt.gz"), the resulting output was, understandably, garbage, but thereafter the terminal font also became garbled in a similar fashion, and while all commands ran the best I could tell, I could never get the original terminal fonts back (to readable English) until I restarted the machine...

Anyone else know about this behavior / can replicate this? Is this a weird bug, or specific to my machine, or what? This is for the most recent (as of 6/19/2013) Slackware 14, from a 32-bit DVD ISO with full installation (downloaded from the slackware site). This is while in the console, before any windows X environments / GUI.

Thanks! Just sharing.

roreilly 06-20-2013 10:11 AM

This is not a bug, this is expected behaviour.

Read this: http://www.cyberciti.biz/tips/bash-fix-the-display.html

The article offers some solutions on resetting your tty.

TobiSGD 06-20-2013 10:38 AM

This is not a bug. The cat command writes the file to stdout as is, which causes the shell to interpret some of output as control characters that can indeed do weird things.
To get the normal behavior back just use the command
Code:

reset
If necessary just type it in blindly.

H_TeXMeX_H 06-20-2013 11:21 AM

Like said above, it is not a bug.

Use 'most' or 'less' instead to view binary files on the command line.

digitalyuki 06-20-2013 02:55 PM

Very helpful!
 
Thanks for the answers folks, that was quick and helpful, ever post contributed something useful and informative.

Most interesting that the binary characters are interpreted as commands in cat. I wonder what it actually does...

Thanks!

frieza 06-20-2013 04:41 PM

Quote:

Originally Posted by digitalyuki (Post 4975592)
Thanks for the answers folks, that was quick and helpful, ever post contributed something useful and informative.

Most interesting that the binary characters are interpreted as commands in cat. I wonder what it actually does...

Thanks!

technically not as commands, but rather 'escape sequences'
http://en.wikipedia.org/wiki/Escape_sequence
in short, an escape sequences are control codes that direct how the terminal displays, and errant data in binary files can be mis-interpreted as escape sequences, jazzing things up,
it gets even WORSE if you try an PRINT a binary file, trust me on this, just don't, it's ugly

volkerdi 06-20-2013 06:56 PM

Quote:

Originally Posted by frieza (Post 4975649)
technically not as commands, but rather 'escape sequences'
http://en.wikipedia.org/wiki/Escape_sequence
in short, an escape sequences are control codes that direct how the terminal displays, and errant data in binary files can be mis-interpreted as escape sequences, jazzing things up,
it gets even WORSE if you try an PRINT a binary file, trust me on this, just don't, it's ugly

However, escape sequences can cause something else in the file to be interpreted as a command entered at the command line. It's easy to make a file that when catted will execute any command(s) as the user that catted the file.

jpollard 06-23-2013 03:52 PM

Quote:

Originally Posted by volkerdi (Post 4975697)
However, escape sequences can cause something else in the file to be interpreted as a command entered at the command line. It's easy to make a file that when catted will execute any command(s) as the user that catted the file.

I think that depends on the terminal emulator. In the past it was to load an indent string into the terminal, then followed by requesting an ident by escape sequences.

I don't believe all terminal emulators support setting the identification string.


All times are GMT -5. The time now is 03:10 PM.