bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: After 'cat' command on binary files : BUG on display


From: Bob Proulx
Subject: Re: After 'cat' command on binary files : BUG on display
Date: Thu, 4 Feb 2010 14:37:31 -0700
User-agent: Mutt/1.5.18 (2008-05-17)

david johann wrote:
> I tried to display binary files with 'cat':
> $ cat ~/an_audio_file.rm
> $ cat /bin/cp

That isn't expected to behave nicely.  You really shouldn't be doing that.

> What I expected:
> ----------------
> --> displaying unreadable chars from the binary file;
> --> and then coming back to the prompt normally!

Unfortunately for you your expectations were incorrect.  The 'cat'
program is not a file viewer program.  Although it is often used to
throw file contents to the terminal that is only done with the full
knowledge that it is a "hack" and isn't a perfectly correct usage of
it.  The purpose of the 'cat' program is to concatenate files to the
standard output.  In this case stdout is your terminal.  But your
terminal is confused by the data you have sent to it.

Binary files contain random data.  Your terminal interprets escape
sequences.  That random data happens to put your terminal into a
confused state.  That is not a failure of the 'cat' program nor is it
a failure of your terminal.  It is a user error.

Instead use a file browser program such as 'more', 'less', or 'most'.

> Could you please reply to me shortly, just to know whether this report was
> useful or not?

Perhaps the information gained from it is useful to others who search
for similar problems.

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]