Unix: How to fix UNIX garbage characters in your terminal

1:44:00 PM 0 Comments


Unix: How to fix UNIX garbage characters in your terminal

Sometimes, viewing binary characters on your unix terminal may switch your font so that it all seems like garbage. This happens when the binary character 0x0E is printed on your terminal. This is the ASCII character for SHIFT-OUT. See the link given below.
This can easily be fixed by entering the CONTROL-O (^O) character into the terminal by using cat.

Example


[csl@ares:~]$ cat somefile.pdf
(lots of garbage)
[GARBAGE]$ cat -
^O

[csl@ares:~]$ 
You could also just press CONTROL-V CONTROL-O ENTER right at the prompt also:
[csl@ares:~]$ ^O
bash: : command not found
[csl@ares:~]$
(If you want to try switching back to the "garbage" characters, just type CONTROL-V CONTROL-N ENTER.)
In the example, you use the cat command to accept input from stdin. Now type CONTROL-V CONTROL-O. This gives the output '^O'. Now hit CONTROL-D and ENTER to end the stream and close cat. The garbage is now gone.
The ^O character is actually the ASCII value of the SHIFT-IN character. If you're interested in knowing how this works, check out the ASCII Character sets page.
I often use this neat trick when using SecureCRT to connect to a Unix box from my Windows environment.

No carriage return

Another nuisance may be that the terminal behaves strange, e.g. it won't use the whole window, or hitting ENTER will only place the cursor one line down, without resetting the horisontal position:
[csl@ares:~]$ 
              [csl@ares:~]$ 
This can usually be fixed by resetting your terminal. Just type the comment reset to reset your terminal. That will usually fix the problem:
[csl@ares:~]$ reset
Kill is control-U (^U).
Interrupt is control-C (^C).
[csl@ares:~]$ 
This command just initializes your terminal.

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard.