LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-19-2006, 07:59 AM   #1
curos
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 72

Rep: Reputation: 15
cat safely without messed up terminal


Maybe I'm making this up, but was there a way to run the command 'cat' safely wihtout accidentally messing up the terminal with garbage characters? I know you can just run 'reset', but was wondering if there was a way to run cat safely.
 
Old 08-19-2006, 08:07 AM   #2
Bruce Hill
HCL Maintainer
 
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,940

Rep: Reputation: 129Reputation: 129
I don't understand what you mean by "cat safely" or "garbage characters",
unless you were trying to cat a binary file or something.
Code:
bash-3.1$ cat useful-commands 
ldd `which fluxbox`|awk '{print $1}' > fluxlibs
grep -lf fluxlibs /var/log/packages/*

Flux (mine, at least) is linked against libs from following packages:
Code:

/var/log/packages/cxxlibs-6.0.3-i486-1 /var/log/packages/elflibs-9.1.0-i486-2 /var/log/packages/expat-1.95.7-i486-1 
/var/log/packages/gcc-3.3.4-i486-1 /var/log/packages/gcc-g++-3.3.4-i486-1 /var/log/packages/x11-6.8.1-i486-3 
/var/log/packages/zlib-1.2.2-i486-2

posted by Tinkster in LQ
Could you post an example?
 
Old 08-19-2006, 08:11 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,700

Rep: Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895Reputation: 5895
The terminal can only display printable ASCII characters i.e a-z, 0-9 etc. The garbage is cause by non-printable ASCII characters in the data. Save the data to a file and view it with a hex editor like hexedit. I'm sure there are other methods but this is what I use.

What are you trying to do?

Last edited by michaelk; 08-19-2006 at 08:14 AM.
 
Old 08-19-2006, 12:22 PM   #4
Alien Bob
Slackware Contributor
 
Registered: Sep 2005
Location: Eindhoven, The Netherlands
Distribution: Slackware
Posts: 8,559

Rep: Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106Reputation: 8106
You probably mean
Code:
cat -v
Eric
 
Old 08-19-2006, 04:03 PM   #5
curos
Member
 
Registered: Aug 2003
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: 15
Thanks Alien Bob, that's what I was looking for. The reason being that I wanted to set an alias for cat so that my terminal doesn't get messed up. Just wondering now if this has any bad side effects...

And to clarify, yes, I did mean using cat on binary files. It messes up the terminal in such a way that all normal ascii characters are displayed by weird nonintelligible symbols.
 
Old 08-20-2006, 12:42 PM   #6
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
In addition to "cat -v" you can use the "strings" utility to safely display an object file's content (useful if you're looking for a pattern in a file).
 
Old 08-20-2006, 01:54 PM   #7
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
I used to get that until I made a habit of using 'less' or 'more' instead of 'cat' -unless you are prowling around in /proc, in which case 'cat' is better.
 
  


Reply



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
can you apply 2.6.x kernel config to 2.4.x safely/somewhat safely? silex_88 Linux - Software 3 12-09-2005 11:38 PM
How to safely re-partition squinn Linux - Newbie 3 08-23-2005 02:38 PM
Terminal Questions? "cat /dev/tty1" Why Not? chris318 Linux - Security 1 02-25-2005 09:57 PM
Terminal Questions? "cat /dev/tty1" Why Not? chris318 Linux - Newbie 3 02-24-2005 10:59 PM
Virtual terminal permissions messed up Zoombie Linux - Software 0 12-26-2003 11:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:18 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
Open Source Consulting | Domain Registration