Tuesday, September 3, 2013

ls - no colors on Ubuntu

I have some older Ubuntu servers that don't display colors when executing the ls command over Putty. So I took a .bashrc file from a different Ubuntu server and copied over the relevant section that contains the ls --color command. After that I applied the ~/.bashrc file so I don't have to restart the session. This will set the foloring for grep and vi as well.


~$ vim ~/.bashrc

if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=auto'
    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
    alias vi='vim'

else
    alias ls="ls -F"
    alias ll='ls -alF'
    alias la='ls -A'
    alias l='ls -CF'
fi


~$ source ~/.bashrc

References


No comments:

Post a Comment