To become a superuser (root user) on Ubuntu Linux, you can either use the su
command or the sudo
command.
- Using
su
:- Open the terminal
- Type
su
and press Enter - Enter the root user password when prompted
- You are now the superuser and your shell prompt should show a “#” symbol instead of “$”
- Using
sudo
:- Open the terminal
- Type the command you want to run as root followed by
sudo
- Enter your user password when prompted
- The command will be executed with superuser privileges.
Note: It is recommended to use sudo
over su
for security reasons.