I wonder what's the exact difference between these 2 commands:1. su 2. su - . Can anyone please explain?
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 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.