7

When I was installing Python 3 on Ubuntu 18.04, I came across the command

sudo -H pip install -U pip

What does -H do?

18

From man sudo:

-H, --set-home
            Request that the security policy set the HOME environment variable 
            to the home directory specified by the target user's password 
            database entry.  Depending on the policy, this may be the default 
            behavior.

So the -H flag makes sudo assume root's home directory as HOME instead of the current user's home directory. Otherwise some files in the user's home directory would become owned by the root, which may lead to various problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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