fixing garbled display

200 views
Skip to first unread message

Quentin Christensen

unread,
Sep 12, 2000, 1:06:59 AM9/12/00
to
Hello,

Being fairly new to linux, I've found myself looking (cat or more) at lots
of files, just to get an idea of what's where and what I need to play with
to do what (though being careful when i do play :). Anyway, a couple of
times I've looked at a file I shouldn't have (ie, a binary file of some
sort), and the display becomes garbled - instead of letters I have lines
and those block-drawing characters.

I thought maybe if I 'reload' my font (the way it's loaded in the rc.d
directory in Slackware), that might fix it, but it doesn't do anything -
if I change to different size font, the 'size' changes, but it's still
garbled.

Any suggestions (apart from not 'cat'ting binaries to screen) ?

Regards

Quentin.
--
My Win9x Cursors: http://www.ozemail.com.au/~mynx/quentisl/cursors.html
Please don't send me junk leaves! (take them out before replying).

No Silicon Heaven? But where do all the calculators go? - Kryten.

Peter T. Breuer

unread,
Sep 12, 2000, 3:04:57 AM9/12/00
to
Quentin Christensen <quen...@leaves.ihug.com.au> wrote:
: Any suggestions (apart from not 'cat'ting binaries to screen) ?

Type "reset" blind.

Alternatively, type "echo ^V^O" blind (those are control chars).

Peter

Floyd Davidson

unread,
Sep 12, 2000, 4:58:14 AM9/12/00
to
quen...@leaves.ihug.com.au (Quentin Christensen) wrote:
>Hello,
>
>Being fairly new to linux, I've found myself looking (cat or
>more) at lots of files, just to get an idea of what's where and
>what I need to play with to do what (though being careful when
>i do play :). Anyway, a couple of times I've looked at a file
>I shouldn't have (ie, a binary file of some sort), and the
>display becomes garbled - instead of letters I have lines and
>those block-drawing characters.
>
>I thought maybe if I 'reload' my font (the way it's loaded in
>the rc.d directory in Slackware), that might fix it, but it
>doesn't do anything - if I change to different size font, the
>'size' changes, but it's still garbled.
>
>Any suggestions (apart from not 'cat'ting binaries to screen) ?
>
>Regards
>
>Quentin.

You are hardly alone! (And it is not restricted to newbies.)

But there are some easy fixes, and some elegant fixes.

You can type in "reset" and hit return, and it probably will fix
things. But then again, it might not. In particular I commonly
get in a fix where clearing the screen does not work, and reset
doesn't fix that.

Here is a trick that will fix *anything*. Put some version of
this into your ~/.bashrc file. If you have standardized on
using one size of xterm, and that is the only shell command line
you ever see, then you only need one alias defined. On the
other hand, if you might have half a dozen different sizes or
other varieties of shell screens, you may need to define either
different ones using different names, or have your ~/.bashrc
file look at the TERM variable and define an alias differently
for different terminals.

# basic command, for a 80x25
alias sane='echo -e "\\033c";tput is2;stty sane line 1 rows 25 columns 80'

# generic version, no size...
alias sane='echo -e "\\033c";tput is2;stty sane line 1'

# my idea of a "standard size xterm"
alias xsane='echo -e "\\033c";tput is2;stty sane line 1 rows 30 columns 100'

# 80x24 terminal (vt100/vt102)
alias vsane='echo -e "\\033c";tput is2;stty sane line 1 rows 24 columns 80'

###
### Here is one way to select different definitions of "sane"
###
if [ "${TERM}" = "emacs" ]
then
# I do a lot of things to make an emacs shell work right,
# such as get rid of the color with my ls aliases, change
# the prompt, and redefine my "sane" command.
export PS1='\h::\u \w >'
stty sane -onlcr onocr -echo -ixon -ixany rows 30 columns 100
stty -onlcr
alias ll='/bin/ls -lF'
alias la='/bin/ls -alF'
alias ls='/bin/ls -xF'

elif [ "${TERM}" = "ansi.sys" ]
then
# set up for a DOS terminal using ansi.sys
alias sane='echo -e "\\033c";tput is2;stty sane line 1 rows 25 columns 80'
stty sane -ixon -ixany rows 25 columns 80
elif [ "$TERM" = "xterm" ]
then
alias sane='echo -e "\\033c";tput is2;stty sane line 1 rows 30 columns 100'
else
alias sane='echo -e "\\033c";tput is2;stty sane line 1'
fi

--
Floyd L. Davidson fl...@barrow.com
Ukpeagvik (Barrow, Alaska)

Andrew N. McGuire

unread,
Sep 14, 2000, 1:17:27 AM9/14/00
to
On 12 Sep 2000, Peter T. Breuer quoth:

PTB> Quentin Christensen <quen...@leaves.ihug.com.au> wrote:
PTB> : Any suggestions (apart from not 'cat'ting binaries to screen) ?
PTB>
PTB> Type "reset" blind.
PTB>
PTB> Alternatively, type "echo ^V^O" blind (those are control chars).

[ good advice as usual, however... ]

That often times does not work reset enough to allow 'clear' to
work properly. IIRC, echo CNTRL+vESC+c will do a full reset.
( I have this as an one key alias ). Some people do a tput and
and or stty, etc, after this... I have never found that necessary,
although in some cases it may be (I don't know for sure, I am not
a term guru).

I use perl -e 'print "\ec"' as my actual alias, that way I dont
embed control chars in my init files ( plus \e is clearer than
\033 to me). This usually fixes the 'clear' problem.

[ Thomas Dickey: If you are reading this, don't hammer me too hard
for my term ignorance. :-) ]

All the Best!

anm
--
print map y="= = && $_ => <"\bJust> =>
=> <"Another> =>
=> <"Perl> =>
=> <"Hacker\n> =>

Reply all
Reply to author
Forward
0 new messages