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.

2 Answers 2


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 ]
    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'
  • thanks! ls colors work again. Oct 23, 2021 at 10:48

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".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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