What is the Difference between 'su' and 'su-' ?
Answers were Sorted based on User's Feedback
Answer / ramesh seervi
both command is used for switch the user but su will drop
you on the current directory and su - will drop you on the
user's home directory
Is This Answer Correct ? | 45 Yes | 2 No |
Answer / papseddy
there is little difference in both of these commends...
su --> just switch you to user mode (root) but didn't provide the complete user environment
su - ---> provide you the complete user environment and also direct jump to user home directory.
Is This Answer Correct ? | 20 Yes | 2 No |
Answer / 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 |
Answer / naresh
SU and SU - doing same job but few diff. is
su <username> is switch user without loading the user environment variable
su -<username> --switch the user with loading the user environment variables.
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / priyanka doiphode
su command is used to switch to local users.
and, su- command is used to switch to 'root user' or 'admin user'
Is This Answer Correct ? | 0 Yes | 1 No |
Write a command that will do the following: -look for all files in the current and subsequent directories with an extension c,v -strip the,v from the result (you can use sed command) -use the result and use a grep command to search for all occurrences of the word orange in the files.
How do you grep?
when zombie process fully cleared?
Who command in linux?
what r the different command to check ram,process and hdd of linux machine
how to see unallocated hard disk space on linux
List the three main parts of an operating system command?
What is #!/ Bin sh?
how many hard disks can i able to connect to desktop pc and server (IDE & SATA) pls send this ans to my mail : ping2pavan@gmail.com
How do I do a whois search?
How do I get to root directory in linux?
what is lilo?How it is useful in linux?