LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-13-2014, 07:06 AM   #1
sryzdn
Member
 
Registered: Feb 2013
Posts: 248

Rep: Reputation: 1
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.
 
Old 03-13-2014, 07:19 AM   #2
nigelc
Member
 
Registered: Oct 2004
Location: Sydney, Australia
Distribution: Mageia 4
Posts: 340
Blog Entries: 4

Rep: Reputation: 63
Just type in
Code:
reset
 
Old 03-13-2014, 08:12 AM   #3
sryzdn
Member
 
Registered: Feb 2013
Posts: 248

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by nigelc View Post
Just type in
Code:
reset
$ cat xxx.bin
$ reset

doesn't work
 
Old 03-13-2014, 08:30 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,937

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
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.
 
Old 03-13-2014, 08:49 AM   #5
sryzdn
Member
 
Registered: Feb 2013
Posts: 248

Original Poster
Rep: Reputation: 1
Quote:
Originally Posted by michaelk View Post
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?
 
Old 03-13-2014, 09:43 AM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,937

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Sure, I typically use hexedit but there are many more.

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

Last edited by michaelk; 03-13-2014 at 09:49 AM.
 
Old 03-13-2014, 10:11 AM   #7
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 4,430

Rep: Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350Reputation: 1350
At the console, I like bpe (binary patch editor), for looking at binary files.
 
Old 03-13-2014, 10:39 AM   #8
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 5,027

Rep: Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845Reputation: 845
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
 
Old 03-14-2014, 05:31 PM   #9
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,604

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Does "syslogd" cause "cat /proc/kmsg" not to work properly? winger9 Linux - General 2 03-04-2014 12:35 PM
how can I "cat" or "grep" a file to ignore lines starting with "#" ??? callagga Linux - Newbie 7 08-16-2013 07:58 AM
script using "/usr/bin/cat error" produces "cannot open" in cron Dcrusoe Programming 6 07-22-2009 04:30 PM
Feeding the output of "diff" or "cat" command to dpkg --purge kushalkoolwal Debian 9 06-19-2008 08:27 AM
Stupid question: if [ "$i" == `$(cat ${LOGFILESSHD} | grep "${i}" )` ] ; then frenchn00b Programming 6 05-19-2008 06:16 PM


All times are GMT -5. The time now is 09:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration