Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I just installed go to /usr/local/go, and in ~/.bashrc added this line:

export PATH=$PATH:/usr/local/go/bin

Now go works from the command line, but sudo go gives me:

$ sudo go
sudo: go: command not found
~
$ sudo echo $PATH
/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/benjamin/algs4/bin:/usr/local/go/bin
share|improve this question
    
Can you post the output of sudo echo $PATH –  Manish Sinha Apr 2 '12 at 17:36

2 Answers 2

up vote 4 down vote accepted

sudo has env_keep and env_reset parameters in sudoers file: http://brandonhutchinson.com/wiki/Sudo_and_environment_variables

You have to either edit your env_keep setting or use sudo -E

share|improve this answer

Just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command below.

sudo ln -s /usr/local/go/bin/go /usr/bin/go
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.