LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Colour with ls -al|more (http://www.linuxquestions.org/questions/slackware-14/colour-with-ls-al%7Cmore-4175452385/)

johnmtb 03-02-2013 09:54 AM

Colour with ls -al|more
 
Dear All,

i have already included colours when i issue the ls -al command, but the colours disappear when i modify that command as follows: ls -al|more.

there used to be a method of adding colours when issuing this command, but i forget it and cannot find any reference to it anymore.

i have been using Slackware Linux since 1992, i believe it was version 1.2, or 2.1 and i love the command screen, but i do want colour all the way.

please help me get abck my colour when issuing the ls -al|more command.

regards,

john

GazL 03-02-2013 10:08 AM

Change COLOR=auto to COLOR=always in /etc/profile.d/coreutils-dircolors.sh

Or override the alias in your own .bashrc (which would be my preference)

David the H. 03-02-2013 01:06 PM

Console colors are produced through the use of ansi escape codes, a kind of embedded mark-up text that controls the way the console display behaves.

This requires both the output program to be able to produce the embedded codes, and the displaying program to be able to interpret them. So you generally need to ensure that both programs have their respective "color" options enabled (if any).

Most console programs like ls are smart enough not to embed escape codes when their output is being sent through pipes or file redirections (you usually do not want such extraneous characters in command inputs or raw text files). That's the behavior of the "--color=auto" option. Changing it to "--color=always" forces it to embed the codes no matter what the output target is.

As for the display program, I think more just relies on the terminal itself for its display, but other programs often need to have it explicitly enabled. less, for example, uses the "-R" option to enable ansi color interpretation.


All times are GMT -5. The time now is 04:05 PM.