Cant run any commands - -bash: ls: command not found [duplicate]

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.

1

1 Answer

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.

5

You Might Also Like