LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   restore characters in "cat" (https://www.linuxquestions.org/questions/linux-newbie-8/restore-characters-in-cat-4175498023/)

sryzdn 03-13-2014 06:06 AM

restore characters in "cat"
 
Hi,

How can I reset the cat command to restore the normal characters of a binary file?

Thanks for your help.

nigelc 03-13-2014 06:19 AM

Just type in
Code:

reset

sryzdn 03-13-2014 07:12 AM

Quote:

Originally Posted by nigelc (Post 5133775)
Just type in
Code:

reset

$ cat xxx.bin
$ reset

doesn't work

michaelk 03-13-2014 07:30 AM

What do you mean by restore normal characters of a binary file?

Since a binary file contains non printable characters when you run cat xxx.bin you will see garbage which can mess up the terminal. Executing reset should return things back to normal.

sryzdn 03-13-2014 07:49 AM

Quote:

Originally Posted by michaelk (Post 5133815)
What do you mean by restore normal characters of a binary file?

Isn't there any way to see readable characters instead of the garbage using cat and some options?

michaelk 03-13-2014 08:43 AM

Sure, I typically use hexedit but there are many more.

http://en.wikipedia.org/wiki/Comparison_of_hex_editors

allend 03-13-2014 09:11 AM

At the console, I like bpe (binary patch editor), for looking at binary files.

schneidz 03-13-2014 09:39 AM

Code:

[schneidz@hyper perceptionists-black-dialogue]$ strings "01 - Let's Move.mp3" | head -n 20 && strings "01 - Let's Move.mp3" | tail
lyPRIV
www.amazon.com
TIT2
TPE1
TALB
TCON
TCOM
TPE3
TRCK
TYER
COMM
TPE2
TCOP
TPOS
APIC
image/jpeg
JFIF
$3br
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz
        #3R
]k[(li
#gB
{aTAQ
nIml
K        z0
LAME3.97UUUUUUUUUUUUUUUUUU
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUTAGLet's Move
The Perceptionists
Black Dialogue
2005Amazon.com Song ID: 21156823


jpollard 03-14-2014 04:31 PM

reset depends on the terminal type. If it doesn't work, you can always try "stty sane" which doesn't.


All times are GMT -5. The time now is 01:43 PM.