Score:0

Accidently make ls colors (folders, files, links...) to white

jp flag

enter image description hereI accidentally delete/change LS colors when listing directories with the 'ls' command, so I tried the command "ls --color=auto" it works temporarily because when I reboot my terminal ls colors return to just white.

Score:3
vn flag

By default, your ~/.bashrc contains a section that defines the ls and grep commands to run in color mode.

The default .bashrc configuration file can be found in the directory /etc/skel, and from here you can take the relevant section and add it back to your ~/.bashrc to restore the default behavior with color support:

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]
then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    alias dir='dir --color=auto'
    alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi
Moez Ben Rebah avatar
jp flag
thanks! ls colors work again.
Score:1
my flag

I'm not sure exactly how Ubuntu works with the default bash alias definitions.

Usually, in your "~/.bashrc" file, you have a source command of "/etc/bashrc". There are many default parameters in this file. And this file load "/etc/profile.d/*" files who contains aliases definitions.

So, do you have modified (accidently) your "~/.bashrc" file or your "~/.bash_profile" ? The last one usually source "~/.bashrc".

If you are non interrested to load default system files (in "/etc"), you cloud add the alias definition "alias ls 'ls --color=auto'" in your own "~/.bashrc".

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.