Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've added the following lines to my .bash_profile at /Users/[my username] :

export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad

And it works fine. However, when I did the same for root's .bash_profile at /var/root it doesn't work. Any ideas why this doesn't work for root?

Thanks.

share|improve this question
    
Yes, I know I'm supposed to use sudo. ;-) Nonetheless, I still would like to know how to enable this for root. –  GeneQ Nov 3 '10 at 13:33
    
My root user's shell is /bin/sh according to dscl. Maybe that's the problem? –  Daniel Beck Nov 3 '10 at 14:12

2 Answers 2

up vote 3 down vote accepted

You can toss those into ~/.profile or source the relevant file from ~/.profile inside the home directory for the root user, and then log in via sudo su - to simulate a full login. It works for me on BASH on Snow Leopard.

As a side note, I define the alias, alias ls='ls -G', in my .bashrc files to enable colour output for ls.

share|improve this answer
    
Changed the name of .bash_profile of root to .profile as you suggested and now it works beautifully. However, .bash_profile works for other users though. Thanks. –  GeneQ Nov 3 '10 at 14:51

Put the following into the /var/root/.bashrc file:

export PS1="\[\033[03;31m\][\u@\h\[\033[03;37m\] \W \[\033[03;31m\]]\\$ \[\033[00m\]"
alias grep='grep --color'
export CLICOLOR='yes'
TERM=xterm-color

Being root, type the following:

chsh -s /bin/bash

Exit and 'sudo su' back to root.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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