Take the 2-minute tour ×

I had edited the bashrc file wrongly in my Ubuntu, while trying to put an "export" command in bashrc for javac.

When I type sudo, it's saying:

Command 'sudo' is available in '/usr/bin/sudo' The command could not be located because '/usr/bin' is not included in the PATH environment >variable. sudo: command not found

How should I correct this?

share|improve this question

migrated from stackoverflow.com Sep 21 '10 at 8:18

This question came from our site for professional and enthusiast programmers.

This question is more suited to superuser.com –  Daniel Haley Sep 20 '10 at 16:53

3 Answers 3

up vote 4 down vote accepted

Restore your .bashrc with the following command:

cp /etc/skel/.bashrc ~

If you want to see the differences between your customized .bashrc and the default one, use this (no changes are made):

diff /etc/skel/.bashrc ~/.bashrc
share|improve this answer

You likely stomped on your existing PATH variable. Make sure that if you export PATH, include the existing PATH, too:

export PATH=$PATH:/whatever/you/added
share|improve this answer

you can just type the full path to sudo:

/usr/bin/sudo vim /etc/bashrc
share|improve this answer
@subhransu: If you did actually edit your system-wide bashrc, I suggest you revert those edits and edit your personal ~/.bashrc instead. –  Matti Virkkunen Sep 20 '10 at 16:57

Your Answer


