0

I am a rookie in the Linux space, especially Ubuntu. For the past few days, I have been getting an error in the terminal every time I start the console. The error says

mkdir: cannot create directory ‘/home/agrim/go’: File exists

Although, console works perfectly fine,but the error is really annoying. Can anyone please help me out with this ?

  • 4
    Whats the output of grep -Hn 'mkdir.*go' ~/.bashrc /etc/bash.bashrc ~/.profile /etc/profile ? – heemayl Mar 22 '16 at 4:32
  • The output is - /home/agrim/.bashrc:117:mkdir ~/go – ashish.one Mar 22 '16 at 6:03
2

It's just a warning, telling you that it's trying to create a directory that already exist.

As your output result is /home/agrim/.bashrc:117:mkdir ~/go

By removing the mkdir ~/go command in /home/agrim/.bashrc file (should be line 117) can help you to get rid of this issue.

That file can be edited with any text editor, e.g. gedit /home/agrim/.bashrc

3

The output of

grep -Hn 'mkdir.*go' ~/.bashrc /etc/bash.bashrc ~/.profile /etc/profile

is

/home/agrim/.bashrc:117:mkdir ~/go

which means in your ~/.bashrc, you have the command mkdir ~/go at line number 117, hence it is being run every time you are starting an interactive shell.

You need to remove that line to get rid of the warning.

You can:

  • Use a text editor like gedit, nano, vim (whatever you prefer), go to line number 117 and remove the line (or put a # infront)

  • Or use sed with pattern matching

    sed -i '/^mkdir[[:blank:]]\+~\/go$/ d' /home/agrim/.bashrc
    
  • Or remove the specific line (line number 117) with sed:

    sed -i '117 d' /home/agrim/.bashrc
    
  • Thanks for your support. The problem was born when I tried to install the 'go' compiler over an existing version. – ashish.one Mar 22 '16 at 7:04

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.