What is su used for in Linux? su , on the other hand, is an acronym for switch user or substitute user. You are basically switching to a particular user and you need the password for the user you are switching to. Most often, the user account you switch to is the root account but it can be any account on the system.
How do you write su command? The general syntax for the su command is as follows: su [OPTIONS] [USER [ARGUMENT]] You will be prompted to enter the root password, and if authenticated, the user running the command temporarily becomes root.
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 .
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.