Ubuntu – How to restore .bashrc file


The terminal shows this when it opens:

bash: /home/atlas/.bashrc: line 73: syntax error near unexpected token `['
bash: /home/atlas/.bashrc: line 73: `if [ -x /usr/bin/dircolors ] ; then '

I've tried to fix it using:

cp /ect/skel/.bashrc ~/

And I get this:

cp: cannot stat `/ect/skel/.bashrc': No such file or directory

I'm unsure of why this is doing this and how to fix it. I had previously been in the .bashrc file messing around and apparently I've messed something up. All I want to do is to restore the .bashrc file to default settings.

Best Answer

I think you got the path wrong - it's etc not ect.

In Ubuntu, there is a default version of the .bashrc file in the /etc/skel/ directory, so if you have problems with it you can restore it.

To do so follow the next steps:

  1. Backup your current .bashrc file:

    cp ~/.bashrc ~/.bashrc.bak
  2. Copy the skeleton .bashrc file over yours:

    cp /etc/skel/.bashrc ~/
  3. Afterwards, load the new one:

    source ~/.bashrc
Related Question