Ben Chuanlong Du's Blog

It is never too late to learn.

Environment Variables and Secure Path for Sudo

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

sudo -E command_to_run

sudo $(which command_to_run)

sudo env "PATH=$PATH" nvim

The "correct" way is to update the secure path using the commanding sudo visudo.

For more discussions, please refer to Chat with Gemini - sudo nvim Not Found, Fixes .

References

Comments