-1

I'm on Oracle Linux.

[root@ol76 systemd]# cat /etc/*release*
Oracle Linux Server release 7.6
NAME="Oracle Linux Server"
VERSION="7.6"
ID="ol"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="7.6"
PRETTY_NAME="Oracle Linux Server 7.6"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:7:6:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 7"
ORACLE_BUGZILLA_PRODUCT_VERSION=7.6
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=7.6
Red Hat Enterprise Linux Server release 7.6 (Maipo)
Oracle Linux Server release 7.6
cpe:/o:oracle:linux:7:6:server
[root@ol76 systemd]#

Why the result of ls has highlighting, but dir doesn't?

enter image description here

  • dir --color=auto – guillermo chamorro Aug 12 at 16:05
  • Yes, that works. Thank you. Could you make it as an answer so that I can accept? – Just a learner Aug 12 at 16:07
  • I just found ls also has color parameter. alias ls='ls --color=auto' – Just a learner Aug 12 at 16:08
  • Done it. Sorry for the spanish, I can't change my LC_ALL to english, but I provide some translation :) – guillermo chamorro Aug 12 at 16:21
  • 1
    @guillermochamorro LC_ALL=C dir --help – muru Aug 12 at 16:23
1

From dir --help:

Using color to distinguish file types is disabled both by default and with --color=never. With --color=auto, ls emits color codes only when standard output is connected to a terminal. The LS_COLORS environment variable can change the settings. Use the dircolors command to set it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.