What's the difference between:
sudo -i
vs
sudo su
Ofcorse... both commands are used to obtain a root shell (become the superuser), they achieve it in slightly different ways.
sudo -i (Recommended): Simulates a fresh login as the root user. It cleans up the environment variables and loads the root user's specific configuration files (.profile, .bash_profile, etc.).
sudo su: Runs the su (switch user) command using sudo privileges. It often creates a "mixed" environment where you are root, but some variables (like your shell settings) might still belong to your original user.
Thanks
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.