Learn GNU/Linux Commands (7): Superuser - su, exit, sudo

When installing GNU/Linux, we are asked to set up the password for the superuser, or root. We are probably asked to set up a normal user as well. The superuser (root) has access to all files, including files that are intended for administrative use only. Normal users are not allowed to access these files. Some programs that alter these files need administration privileges, such as the package management tools that are used to install and remove other programs. We introduce the package management tools later.

We can grant normal users administration privileges with the program "sudo".

Switch user

su [USER]

Switch to USER, if USER is omitted, switch to root. "su" may stand for substitute.

To switch back, use "exit" or "su" with the username before.


The two examples below do the same thing.

[Texpion@com ~]$ su
[root@com ~]# su Texpion
[Texpion@com ~]$ 
[Texpion@com ~]$ su root
[root@com ~]# exit
[Texpion@com ~]$ 

Normally "exit" will exit (close) the shell.


Sudo, sometimes considered as short for Superuser do. If a normal user becomes a sudoer, this user can run various commands as root without needing the root password by adding "sudo " in front of the commands. For example, to edit a configuration file that is intended to by modified by administrators only, with "vi":

[Texpion@com ~]$ sudo vi config_file

The program "sudo" may not be installed be default in distros such as Debian. Though it can be installed manually.

We can set a user as an administrator (sudoer) when we are installing the system if this option is available. We can also edit the configuration file "/etc/sudoers" only with the command "visudo". To make changes, after open the editor, follow the comments. It is not recommended for beginners to edit this file.

We can also add a normal user in the sudoer's group. We introduce group in the next part.




Intel 7th and 8th generation processor graphics driver for Windows 7/8/8.1

AV1 vs VP9 vs AVC (h.264) vs HEVC (h.265): Part II - Fidelity

AV1 vs VP9 vs AVC (h.264) vs HEVC (h.265): Part I - Lossless

OBS Studio settings for best quality (loseless) recording

AV1 vs VP9 vs AVC (h.264) vs HEVC (h.265): Part III - Quality

AV1 vs VP9 vs AVC (h.264) vs HEVC (h.265): Part IV - Decode

Install VMAF on Fedora, CentOS/Red Hat (RHEL)