What is su command used? The su (short for substitute or switch user) utility allows you to run commands with another user’s privileges, by default the root user. Using su is the simplest way to switch to the administrative account in the current login session.
How do you use su root?
- Run sudo <command> and type in your login password, if prompted, to run only that instance of the command as root.
- Run sudo -i .
- Use the su (substitute user) command to get a root shell.
- Run sudo -s .
What is su command used in Linux? The su command lets you switch the current user to any other user. If you need to run a command as a different (non-root) user, use the –l [username] option to specify the user account. Additionally, su can also be used to change to a different shell interpreter on the fly.
How use sudo su command in Linux? To use sudo, let’s just type sudo and press enter. If sudo is installed, the sudo package usage details will be displayed. If it’s not, a “command not found” message will be displayed. Now, let’s see how to install sudo in various Linux distributions if it’s not installed already.