LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-16-2008, 12:15 AM   #1
amit_pansuria
Member
 
Registered: Sep 2006
Posts: 73

Rep: Reputation: 15
less command response is garbled


Helo ,
I m using RHEL 4.

If I run 'ls -laF | more', response is properly display.

but when I run If I run 'ls -laF | less', the response is garbled as shown below:
$ ls -laF|less

<D7><DC><D3><C3><C1><BF> 160
drwxr-xr-x 40 admin pds_system 4096 6<D4><C2> 15 03:12 ./
drwxr-xr-x 9 root root 4096 6<D4><C2> 15 02:12 ../
drwxrwsr-x 2 admin pds_agent 4096 6<D4><C2> 17 19:11 account/
drwxrwxr-x 2 admin pds_system 4096 2007-11-25 archive/
drwxr-xr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 bin/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:12 callsel/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 class/
drwxrwxr-x 6 admin pds_system 4096 6<D4><C2> 15 03:12 config/
drwxr-xr-x 2 admin pds_system 4096 2007-11-25 customs/
drwxrwsr-x 2 admin pds_system 4096 2007-11-25 dnc/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 etc/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 help/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:12 histrpt/
drwxr-xr-x 2 admin pds_system 4096 2007-11-25 imon/
drwxrwxrwt 2 admin pds_system 4096 2007-11-25 ipc/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:11 ivr/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:12 job/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:11 ktbs/
drwxr-xr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 language/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:12 listdist/
drwxrwxrwt 7 admin pds_system 4096 6<D4><C2> 15 02:12 lists/
drwxrwxr-x 5 admin pds_system 4096 6<D4><C2> 15 02:13 man/
drwxr-xr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 menus/
drwxr-xr-x 5 admin pds_system 4096 6<D4><C2> 15 02:12 newconfig/
drwxrwxr-x 6 admin pds_system 4096 6<D4><C2> 15 02:12 openssl/
drwxr-xr-x 2 root sys 4096 2007-11-25 patch/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:12 reportgen/
drwxrwsrwt 2 admin pds_system 4096 2007-11-25 reports/
drwxrwxr-x 4 admin pds_system 4096 6<D4><C2> 15 02:12 sample/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 scripts/
drwxr-xr-x 2 admin pds_system 4096 6<D4><C2> 15 03:12 scrnbld/
drwxr-xr-x 15 admin pds_system 4096 6<D4><C2> 15 03:12 shell/
drwxr-xr-x 2 admin pds_system 4096 2007-11-25 sp_bin/
drwxrwxr-x 5 admin pds_system 4096 6<D4><C2> 15 02:12 staging/
drwxr-xr-x 5 root root 4096 6<D4><C2> 15 03:12 svcpk1/
drwxr-xr-x 4 admin pds_system 4096 6<D4><C2> 15 02:12 switch/
drwxrwxr-x 2 admin pds_system 4096 6<D4><C2> 15 02:12 tape/
drwxr-xr-x 16 admin pds_system 4096 6<D4><C2> 15 02:12 tools/
drwxr-xr-x 2 admin pds_system 4096 2007-11-25 ucb/
dr-xr-xr-x 4 admin pds_system 4096 6<D4><C2> 15 02:12 xfer/




what to do to remove this?

Regards,
Amit

Last edited by amit_pansuria; 06-16-2008 at 12:30 AM.
 
Old 06-16-2008, 07:59 AM   #2
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
Not sure what's going on, here's one suspicion.

Quote:
Originally Posted by amit_pansuria View Post
when I run If I run 'ls -laF | less', the response is garbled as shown below:
$ ls -laF|less
Code:
<D7><DC><D3><C3><C1><BF> 160
drwxr-xr-x  40 admin pds_system 4096  6<D4><C2> 15 03:12 ./
drwxr-xr-x   9 root  root       4096  6<D4><C2> 15 02:12 ../
drwxrwsr-x   2 admin pds_agent  4096  6<D4><C2> 17 19:11 account/
...
What did you expect? You make us guess. Maybe this:
Code:
total 160
drwxr-xr-x  40 admin pds_system 4096  2008-06-15 03:12 ./
drwxr-xr-x   9 root  root       4096  2008-06-15 02:12 ../
drwxrwsr-x   2 admin pds_agent  4096  2008-05-17 19:11 account/
...
It could be that 'ls' is trying to use colors in the output, and 'less' makes those visible or gets confused? This should get rid of it:
Code:
ls -laF --color=never| less
More hints:

Normally coloring is done with escape sequences, which your xterm (or other terminal) consumes, so you don't see them. To check what exactly 'ls' outputs, try
Code:
ls -laF | cat -v
E.g., I see "^[[01;34m" instead of a change to blue bold text.

man ls
Quote:
By default, color is not used to distinguish types of files. That is
equivalent to using --color=none. Using the --color option without the
optional WHEN argument is equivalent to using --color=always. With
--color=auto, color codes are output only if standard output is con-
nected to a terminal (tty). The environment variable LS_COLORS can
influence the colors, and can be set easily by the dircolors command.
You may be using an alias for ls; maybe someone else set it up for you. Check like this:
Code:
$ alias ls
alias ls='ls -FC --color=tty'
My setting (tty) is the same as "auto". In your example, outputting to a pipe (|less) would have turned off coloring.

Last edited by Quigi; 06-16-2008 at 08:01 AM. Reason: enable smilies
 
Old 06-16-2008, 05:13 PM   #3
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 230Reputation: 230Reputation: 230
If you want less to show the colors output by ls, try its "-R" (or "-r") option:
Code:
ls -laF --color  | less -R
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
'sed: command garbled:' error on Solaris fatjack Solaris / OpenSolaris 3 08-25-2006 05:15 PM
Garbled Screen deena102 Mandriva 1 03-12-2006 09:16 AM
Garbled Thanotos Slackware 8 12-11-2005 07:22 PM
garbled resolustion bejiita Slackware 1 08-01-2004 10:04 PM
Evolution: MAIL FROM response error: command unrecognized trickykid LinuxQuestions.org Member Success Stories 14 03-25-2004 01:26 PM


All times are GMT -5. The time now is 11:18 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration