[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: After 'cat' command on binary files : BUG on display
From: |
david johann |
Subject: |
Re: After 'cat' command on binary files : BUG on display |
Date: |
Thu, 4 Feb 2010 22:57:25 +0100 |
Thank you very much!
2010/2/4 Bob Proulx <address@hidden>
> 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
>