0

When I do

vim .bashrc 

and try to edit the file it gives following error.

Can't open linked file for editing

When I do

ls -la 

it shows

.bashrc -> /home/likewise-open/company/user/dotfiles/.bashrc

When I try to cd into dotfiles, it says directory does not exist.

Please help.

4

It seems your .bashrc is just a link to some other place .bashrc -> /home/likewise-open/company/user/dotfiles/.bashrc.

This is not a normal attitude, so instead of using sudo or whatever you have to bring it back to its normal place.

sudo cp /home/likewise-open/company/user/dotfiles/.bashrc ~

Then now change ownership if it's not owned by you:

sudo chown your-username:your-username ~/.bashrc

Now ensure it has the correct permissions:

chmod 644 ~/.bashrc

But since you say this:

When I try to cd into dotfiles, it says directory does not exist.

This means the /home/likewise-open/company/user/dotfiles/.bashrc file is not founded and had been deleted, so for that you get the message:

Can't open linked file for editing

This means the link is point to non existing file thus a broken link.

So you get a default bashrc file from /etc/skell

cp /etc/skel/.bashrc ~/
2
  • Unless it has a very strange configuration, they can do it without root. ~ is their, so they can delete the link (rm .bashrc) and then copy the enterprise skeleton: cp /home/likewise-open/company/user/dotfiles/.bashrc ~, which must be readable anyway. – Rmano Jun 13 '15 at 8:00
  • @downvoter. so why downvote? – Maythux Jun 13 '15 at 9:41
0

If your dotfiles directory was deleted, meaning your bashrc points to a dir that does not exist try removing the destination before copying etc/skel/

cp --remove-destination /etc/skel/.bashrc ~/
-1

You need superuser permissions to edit the file.

To become the superuser, type in sudo -s then enter your password. After you log in, then try your command, and it will work.

4
  • I tried sudo -s vim .bashrc and entered password still it did not work – ashishjmeshram Jun 13 '15 at 4:51
  • Try echo "my edit" | sudo tee -a /etc/bash.bashrc – Mayur Kulkarni Jun 13 '15 at 5:01
  • -1, why should he need sudo to edit ~/.bashrc? ~/.bashrc is by default owned by the user. – kos Jun 13 '15 at 5:23
  • sudo chmod og=rw bash.bashrc can change the owner of bashrc , assuming that the OP might've accidentally executed this , its just a matter of simplicity to execute the command as root – Mayur Kulkarni Jun 13 '15 at 6:55

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.