Knowledgebase: Operating Systems > Linux
Difference Between "sudo su" and "sudo su -"
Posted by Christopher P. on March 06, 2016 01:37 AM

sudo su

Executing sudo su will call the sudo command with su, calling bash as an interactive non-logon shell. In this case, bash only executes .bashrc. The user executing this command will remain in the same directory that they were in prior to execution, and the same environment as the user they were prior to execution.

sudo su -

Executing sudo su - initiates a login shell. In this case, bash executes .bashrc, .profile, and /etc/profile. The user executing this command will find themselves in root's home directory and will also have root's environment.

(31 vote(s))
Helpful
Not helpful