LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   'su' vs 'su -' - What's the difference? (https://www.linuxquestions.org/questions/linux-newbie-8/su-vs-su-whats-the-difference-4175477255/)

junior-s 09-16-2013 12:33 AM

'su' vs 'su -' - What's the difference?
 
What's the difference between these two:

Code:

su
and
Code:

su -
Regards.

pan64 09-16-2013 12:54 AM

see the man page:
-, -l, --login
make the shell a login shell

with - the new shell will be a login shell therefore a new environment will be set.
without - the new shell will inherit the environment from the parent.

bebetter 09-16-2013 03:32 AM

-l Simulate a full login. The environment is discarded except for HOME, SHELL, PATH, TERM, and USER. HOME and SHELL are modified as above.
USER is set to the target login. PATH is set to ``/bin:/usr/bin''. TERM is imported from your current environment. The invoked shell is
the target login's, and su will change directory to the target login's home directory.

- (no letter) The same as -l.


All times are GMT -5. The time now is 12:57 PM.