4

I am logged into a remote shell and I had root access to this. I was trying to edit my .bashrc and .bashrc_profiles files when suddenly my connection snapped, leaving the files open. I suspect something went wrong. How can I restore these files from the command line?

I tried copying from /etc/skel, however my cp command is also not working. Neither do nano or vim work.

emk2203
  • 4,166
  • 1
  • 21
  • 47
User3
  • 143
  • 3
    Did you try with /bin/cp ...? Your $PATH variable might be not set correctly due your problem. – Thomas Mar 11 '17 at 11:51

1 Answers1

4

It sounds like you broke your $PATH. That's easy to fix though, you can still use the full path to a command. So, for example, to get the default .bashrc back, you can do:

/bin/cp /etc/skel/.bashrc ~/

Same for nano and vim, just use /bin/nano and /usr/bin/vim. Finally, note that there's no such thing as .bashrc_profiles. There is ~/.profile, ~/.bash_profile (if this file exists, ~/.profile is ignored by bash), and ~/.bashrc.

terdon
  • 100,812
  • Thanks terdon, I will try this. I had mistakenly typed it wrong - A bit of a lazy weekend. Cheers! :) – User3 Mar 11 '17 at 13:11
  • I executed /bin/cp /etc/skel/.bashrc ~/ but no effect, is there anything to be done to refresh and propagate these changes? – User3 Mar 11 '17 at 13:31
  • 3
    @User3 the PATH is usually set in ~/.profile. So, to revert everything back to default, run /bin/cp /etc/skel/.{bashrc,profile,bash_profile} ~/. Then log out and log back in. – terdon Mar 11 '17 at 14:04
  • logged out and in again, everything restored. Thanks a ton bud :) – User3 Mar 12 '17 at 06:09
  • However for others who might stumble here, I had messed up the enviornments file in etc. I cleared that and all was good! – User3 Mar 12 '17 at 06:12