1

This question already has an answer here:

When I run the ls command using sudo-powers the file and directory names are all in white. When I run it as user the directory names are in bluish-purple, the scripts are in green and and the Asembler program is in white.

I did do a modification to from "color-prompt = YES" or something like that in some place but I don't remember configuring colour file names based on my User ID.

Example

Sudo colours

I like the coloured file types, how can I extend this to sudo?

marked as duplicate by muru, Parto, Zanna, Eric Carvalho, TheWanderer Nov 9 '16 at 13:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Does sudo ls --color=auto work? – fkraiem Nov 9 '16 at 1:59
  • @fkraiem Yes it does! Do you want to post that as an answer? I'll upvote it of course but can it be automated? – WinEunuuchs2Unix Nov 9 '16 at 2:01
  • 1
    Very probably your ls is aliased to ls --color=auto (run alias to find out), but when you run ls with sudo the alias is not kept. I cannot think right now of a way to keep it... – fkraiem Nov 9 '16 at 2:09
  • Indeed something has set up an "alias ls='ls --color=auto'" plus 7 other aliases including three for egrep, fgrep and grep (the first two I"ve never heard of) so it's an interesting situation. Does the same happen on your terminal? – WinEunuuchs2Unix Nov 9 '16 at 2:40
  • 1
    Yes, those aliases are set in ~/.bashrc by default. – fkraiem Nov 9 '16 at 2:52

Browse other questions tagged or ask your own question.