When I was installing Python 3 on Ubuntu 18.04, I came across the command
sudo -H pip install -U pip
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
-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.
-H flag makes
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.