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?
3 Answers
Try with less command with repaint(-R) option:
ls --color=always -l | less -R
-
-
1Shouldn't it be
-R
(only change is uppercase R)? See here for why... Oct 5, 2011 at 11:37 -
-
3Actually it also works with
more
with the--color=always
, so that was the key for me!– NilzorOct 7, 2011 at 8:11 -
1Unfortunately this doesn't work for Mac OS X / BSD, but is fine for Linux Dec 4, 2014 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