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.


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
| improve this answer | |
  • 3
    this answer should be marked as correct. – llt Jun 20 '13 at 6:23

Copy the contents of https://gist.github.com/marioBonales/1637696/raw/337f7b60d4e3d9e887a0206dec6a737e94cdd26e/.bashrc

to ~/.bashrc. You can use a text editor such as gedit for this.

| improve this answer | |

You don't necessarily need to recreate it, just look at what the error message is telling you. It's saying that you have a syntax error in your file. With what you have, I'd say it's incorrect in key places.

Instead of

if [ -x /usr/bin/dircolors ] ; then

It should be

if [ -x /usr/bin/dircolors ]; then

Note the lack of space between the ] and the ;.

Also, for reference, here's that whole if block:

# 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 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'
| improve this answer | |
  • 2
    That space shouldn't actually matter. The command if [ -x /usr/bin/dircolors ] ; then echo yay; fi outputs yay for me ;) Note the space between ] and ;. – Malte Skoruppa Sep 18 '14 at 8:48

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.