Sean,
Here's a long answer to a short problem. 
cat'ing binary files is not usually desirable. What is
happening is that some of the binary codes are
interpreted as control characters and are fed to
/dev/tty... and to your screen. These alter your
display and the result is unreadable. Sometimes they
will give new color schemes, sometimes strange graphic
characters and sometimes will render that tty session
unusable.

The first thing to try is [ stty sane ] stty means
set-tty. With it you can set erase characters and
loads of other things about your terminal session.
'sane' is an stty command which attempts to restore
your terminal session to a 'sane' state. It use to
work better on old tty terminals but now with telnet
sessions, ssh and xwindows clients it doesn't function
so well. Still, "stty sane" is the first thing to try.
After that you can "exit" or log off or kill the
session from another tty session.

Now, with regard to viewing binary files safely there
are a few tricks to try. The command 'strings'
[strings  filename] will put out only the printable
ascii characters in filename, withholding anything
non-printable such as the junk that screws up your tty
session. You can view a word document this way and see
all the text without the formatting.

There is a utility I like called 'hexdump' it has
various options that allow display of each byte or bit
string as ascii, octal, hex and a few other things.
With this you can see the contents of a file with
printable characters displayed in ascii and
non-printable characters displayed in octal, hex or
binary. This is preferable to using 'cat'.

Check: man hexdump for the various options.

cat, but the way, is short for 'concatenate'. when you
string several filenames after the 'cat' command it
will concatenate them in the output stream. That is
handy sometimes. By default, cat writes to standard
output and, by default, stdout is your terminal
session. That is why cat is used to display ascii
files on the screen. 

With regard to server space, I'll respond to that in a
separate email since that brings up a separate issue.

Wayne


--- Sean Dembrosky <[EMAIL PROTECTED]> wrote:
> I thought of you first when I ran into this problem,
> I think you would have a quick and easy answer to
> it...
> I try to 'cat' a binary file, like let's say
> /boot/message although other (binary?) files do this
> as well.  It concatenates a binary type read, and
> leaves my bash prompt "binarized", everythings
> jarbled and crazy.  The only way out, is to type
> 'exit' amidst the binary craziness.  What is going
> on here?
> 
> By the way, I have a large server space available,
> if you are interested in conducing some experiments
> through it, let me know, and I'd be glad to oblidge.
> 
> Sean Dembrosky
> 
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

Reply via email to