I am reading some tutorials about Linux configurations:
- To accomplish many of the configurations is important and mandatory be the
root
.
Well I did realize that in many places are used sudo su
and sudo -i
, even when both accomplish the the same goal, I have the doubt about:
- when is mandatory use one approach over the other?
I am doing this question because for some reason exists these two approaches
As pointed by the user @user535733 in the comments section, both commands will take you to different working directory.
sudo su
will execute commands as root in your present working directory butsudo -i
will take you to your root's home directory (by default to/root
)Another difference is if you are using anything other than bash as your shell
sudo -i
andsudo su
will take you to the shell configured for the root user (bash
is default in Ubuntu) whilesudo -s
uses the shell you configured for your user(e.g,zsh
)