getting ls colors to work for non-root

Howdy,

Not sure what I'm doing wrong, but I cannot seem to get ls to display colors on Debian when the user is non-root. I even tried the same .bashrc from root and it still doesn't work. I never had this prob on the Slackware image. I'm assuming the prob lies outside the .bashrc file. I don't want to work as root all the time but I like being able to differentiate between files/dirs/scripts. Any help would be appreciated. Thanks!

-Brian

2 Replies

Hmmm….have you tried the command 'dircolors' to see what it thinks you should be seeing? Also, if you have an unsupported term-type (ie: I set mine to rxvt-16color) dircolors returns an empty string, and you'll lose all your colors.

echo $TERM to see what it is and then compare that to the list in 'dircolors -p' to make sure your TERM is in that list. I actually hardcode my own colors in my .bashrc like this:

LS_COLORS='no=00:fi=00:di=01;33:ln=01;36:pi=40;33:so=01;35:  \
do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:ex=01;32: \
*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31: \
*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31: \
*.deb=01;31:*.rpm=01;31:*.jpg=01;35:*.gif=01;35: \
*.bmp=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35: \
*.xpm=01;35:*.tif=01;35:*.png=01;35:*.mpg=01;35: \
*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:';
export LS_COLORS

You can do that if you know your terminal is supported but want to use a different TERM for some reason.

yeah I tried that and all comes back normal for colors to work. Also, when I type ls –color=auto myself at the prompt I do get colors. This is funny cause ls is already aliased as ls --color=auto (so it's like I'm typing ls --color=auto --color=auto). I'm actually starting to wonder if the script is even being parsed when I login. I havn't done anything else since this install besides setting up the hostname. Are you using the Debian distro? I'm curious if maybe there's something else I gotta do first…

-Brian

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct