What is the Difference between 'su' and 'su-' ?
Answer Posted / alf55
Answer 2 is the most correct. Really "su" is "switch user"
and its format is "su optional_options optional_username"
where a missing "username" defaults to "root".
The options "-", "-l", and "--login" are all equivalent.
When the "-" is used, the shell is initialized as if logged
into the machine as the specified user (hence you also end
up in your the home directory of "username". Without the
"-", the current environment is left intact but the user has
been switched to that of "username" hence you are still in
the current directory.
From the "man su" page:
{{{
-, -l, --login
Provide an environment similar to what the user
would expect had
the user logged in directly.
When - is used, it must be specified as the last
su option. The
other forms (-l and --login) do not have this
restriction.
}}}
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
Explain the working of command grouping?
Explain difference between nfs soft and hard mouniting points?
How to write the output of a command to a file?
What does chmod 644 do?
Why bash is used in linux?
How do you insert comments in the command line prompt?
How often do you use grep command and how in Linux operating system?
How find ip address linux?
Explain trap command; shift command, getopts command of linux?
What is Data Command?
How to root mirror in linux?
How do you create a blank file in linux?
How do I do a whois search?
How do I find previous commands in linux?
What command should you use to check your file system?