Posted  01 May 2010 - 18:01:44

Category: Linux

sudo actions has different path than the user

You might notice that when you perform an action with the sudo method, your PATH is different than your user's.

Put this in your ~/.bashrc:

alias sudo='sudo env PATH=$PATH'

1 comment:

5/18/2016 5:47:14 PM  Ben  wrote:

This works well for something like the following: >> sudo which pip In that case, it finds the location of the function "pip" in the path of my normal user rather than the path that sudo defaults to. However, it breaks functionality of the following statement: >> sudo -i The result is the following: env: -i No such file or directory

© SolutionCottage 2008-2011 7/26/2017 1:43:49 AM