I wonder what's the exact difference between these 2 commands:1. su 2. su - . Can anyone please explain?


1 Answer 1


The man page describes it fairly well with the following:

   -, -l, --login
          Start the shell as a login shell with an environment similar
          to a real login:

             o      clears all the environment variables except TERM

             o      initializes the environment variables HOME, SHELL,
                    USER, LOGNAME, and PATH

             o      changes to the target user's home directory

             o      sets argv[0] of the shell to '-' in order to make
                    the shell a login shell

I usually think about it in terms of the environment I want, in all honesty I tend to always use su - by default.

Not the answer you're looking for? Browse other questions tagged .