This post introduces the difference between su – and su.
su -
logs you in completely as root, whereas su
makes it so you are pretending to be root.
The most obvious example of this is that ~
is root’s home directory if you use su -
, but your own home directory if you use su
.
Depending on your system, it may also mean differences in prompt, PATH
, or history file.
Check here for more detailed discussion (PDF).