LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-13-2009, 03:20 AM   #1
Don Lope de Aguirre
LQ Newbie
 
Registered: Jan 2009
Location: Frankfurt, Germany
Distribution: debian, CentOS
Posts: 4

Rep: Reputation: 0
the cat ate my charset


hi all,


being still new to linux, I experienced some strange behaviour with the cat command :

I accidentally displayed a non-text file with cat, giving me all sort of strange characters (like, for example, the stuff you see when looking at non-text network data in wireshark).

this would be ok if not the general output in the shell turned to that strange character set as well, i.e. the prompt and every command i typed was displayed in that unreadable way.

is there a way to reset output to what it normally is ?


later,

Don
 
Old 01-13-2009, 03:28 AM   #2
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2beta2 on Lenovo Thinkpad W520
Posts: 6,782

Rep: Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119
Close the terminal you use and open another one.

If you are in console mode (not in graphical mode), logout (Ctrl+d) then login.
 
Old 01-13-2009, 03:40 AM   #3
Don Lope de Aguirre
LQ Newbie
 
Registered: Jan 2009
Location: Frankfurt, Germany
Distribution: debian, CentOS
Posts: 4

Original Poster
Rep: Reputation: 0
Hi,


thatīs what I did .

Isnīt there a more elegant way to do this ?

And what exactly happened here ? Did the file change the character set of the shell or how what is the exact reason for the scrambled output ?


atb,

Don
 
Old 01-13-2009, 03:49 AM   #4
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 130Reputation: 130
Whenever that happens, type
tput reset (even though you cannot make out what you are typing).

The problem is that you were trying to read a binary file. In order to prevent more garbled terminals, it is a good idea to determine the file type prior to using cat. The command to do so would be: file file_name
 
Old 01-13-2009, 03:57 AM   #5
Didier Spaier
LQ Addict
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slint64-14.2beta2 on Lenovo Thinkpad W520
Posts: 6,782

Rep: Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119Reputation: 2119
Quote:
Originally Posted by Don Lope de Aguirre View Post
Isnīt there a more elegant way to do this ?
More elegant, may be. Faster, I guess no

Quote:
Originally Posted by Don Lope de Aguirre
Did the file change the character set of the shell... ?
May be. When you cat a binary file, you send to the shell characters that it can interpret or "understand" as instructions to do something, may be change the character set, may be another (unexpected) function.

Cheers,

[EDIT]Sorry to be late, I didn't see previous answer.

Last edited by Didier Spaier; 01-13-2009 at 04:00 AM.
 
Old 01-13-2009, 04:15 AM   #6
Don Lope de Aguirre
LQ Newbie
 
Registered: Jan 2009
Location: Frankfurt, Germany
Distribution: debian, CentOS
Posts: 4

Original Poster
Rep: Reputation: 0
thanks to all, I hope I can return the favor when I know a little more about linux !

you guys are great and I get the idea of what community is all about .
 
Old 01-13-2009, 11:46 PM   #7
allez
Member
 
Registered: Jul 2008
Location: Russia/Siberia/Krasnoyarsk
Distribution: SuSE, CentOS, FreeBSD
Posts: 77

Rep: Reputation: 21
Quote:
Isnīt there a more elegant way to do this ?
You may try to use reset command.
NB: Sometimes typed symbols are not displayed.

Last edited by allez; 01-13-2009 at 11:49 PM.
 
  


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
help! the cat ate my mouse... salmanal SUSE / openSUSE 2 06-10-2007 01:25 PM
cat in asm/ cat --show-all option Tux Linux - Software 1 09-02-2006 10:31 PM
Vista ate my GRUB! springsteenfan Linux - Software 2 09-19-2005 06:16 PM
Windows ate Linux! RedHattedGnome Linux - Newbie 11 03-30-2003 11:11 AM
GNOME ate my Desktop bandit12 Linux - Software 3 02-27-2003 06:51 PM


All times are GMT -5. The time now is 07:05 AM.

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