Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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.

share|improve this question

3 Answers 3

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
share|improve this answer
Worked, thank you – Miranda Webb Oct 11 '12 at 3:05
this answer should be marked as correct. – llt Jun 20 '13 at 6:23
+1 you are a life saver . thank you :) – rohit shrivastava Aug 19 at 21:35

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'
share|improve this answer
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

Copy the contents of

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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