Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

ls -l gives me color coded output. Folders are blue, executables green, etc. These colors are gone when filtering thorough | more. Anyway to achieve both paged output and colors?

share|improve this question
    
Can you give us a detailed explanation? – Random Guy Oct 5 '11 at 11:21
up vote 7 down vote accepted

Try with less command with repaint(-R) option:

ls --color=always -l | less -R
share|improve this answer
    
That works, and actually more as pager also works. – eldering Oct 5 '11 at 11:29
1  
Shouldn't it be -R (only change is uppercase R)? See here for why... – Breakthrough Oct 5 '11 at 11:37
    
@Breakthrough: +1. i'll update it. – Prince John Wesley Oct 5 '11 at 11:39
2  
Actually it also works with more with the --color=always, so that was the key for me! – Nilzor Oct 7 '11 at 8:11
    
Unfortunately this doesn't work for Mac OS X / BSD, but is fine for Linux – user1442960 Dec 4 '14 at 17:53

Search for the term "escape sequence" in the man page of less. About the colorful stuff, see ANSI escape code # Colors;

There is a detailed solution on askubuntu.com on how to have paged & colored output; the key info is:

ls -C --color=always | less -R
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .