What is the difference between su and su -?
While working on Linux, you might have come across the ‘su’ command which is called substitute user and is used when we need to switch to a particular user.
When we give only su, it will switch to the super user.
Please note that the path has not changed, still we are at the home directory of lenovo user. If you want to switch to a user, and move to the home directory of that user, you will have to use ‘su
The above case is valid if you want to switch to root user. But if you need to switch to a particular user, then you need to specify that user’s name
Please find the man page for su command for your reference
DevOps Gurukul is one of the best training academies which provides Linux courses in Kochi. We have experienced training professionals who are passionate about grooming the right candidates to start their successful careers. Come learn Linux Server Administration course with us and have a bright future!