LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   LS color in RHEL5 (https://www.linuxquestions.org/questions/linux-newbie-8/ls-color-in-rhel5-846680/)

noony123 11-26-2010 06:05 AM

LS color in RHEL5
 
Hi all.

I am using RHEL 5. I wanted to know that if i edit /etc/DIR_COLOR to change the color of files while displaying through ls command, do i need to logout to take it effect or is there any other way ?

i performed the following steps

1) edited the /etc/DIR_COLOR file (using nano)
[root@WAN-Admin ~]# cat /etc/DIR_COLORS | grep -i file
# Configuration file for the color ls utility
# This file goes in the /etc directory, and must be world readable.
# You can copy this file to .dir_colors in your $HOME directory to override
# Below are the color init strings for the basic file types. A color init
FILE 32 # normal file
MISSING 01;05;37;41 # ... and the files they point to
# This is for files with execute permission:
# List any file extensions like '.gz' or '.tar' that you would like

2) run the following command

[root@WAN-Admin ~]# eval 'dircolors /etc/DIR_COLORS'
LS_COLORS='no=00:fi=32:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32: *.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=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:*. bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=0 1;35:*.png=01;35:*.tif=01;35:';
export LS_COLORS

Now when i issue ls command, i am still seeing file with white color. if i logout and then login, the file color successfully changes. So can anyone advice, how to do this without logging out ?

thanks in advance

druuna 11-26-2010 07:34 AM

Hi,

Try: eval $(dircolors -b /etc/DIR_COLORS)

Hope this helps.

noony123 11-27-2010 03:20 AM

Thanks alot, It really worked :-)

druuna 11-27-2010 03:45 AM

You're welcome :)


All times are GMT -5. The time now is 12:49 AM.