Linux Su Command Training Example – How to Get to Work As the Linux Root User – Debain Ubuntu


When working at a Linux desktop as a "regular" Linux user, many times you will need to go to the command line prompt and run System Administration commands.

And to run many of the these commands , you need to work as the user named root (aka Superuser).

Linux Commands Training Tips: The Superuser name is abbreviated as su (and you will see how to use the command of the same name below).

You use the Linux su command (with the – option) at the prompt to change from working as a "regular" user to working as the root user.

A "regular" user is also referred to as a "non-root" user.

For security reasons, you should never log in to a Linux desktop with the user name of root. So, you must log in as a "regular" user and then you're at the desktop and you do the steps to "open" a Linux "terminal emulation window" to go to the command line prompt.

At the prompt as a "regular" user, you need to run the Linux su command to "log in" and change from working as a "non-root" user to working as the root user so you can run the powerful Linux System Administration commands.

Using the Linux su Command to Work as root Superuser

When using Red Hat, Fedora, SUSE, Debian and many other distributions, after logging in to a Linux desktop as a "regular" and "non-root" user, and opening a terminal emulation window, the command line prompt appears as a $ (a dollar sign symbol).

At this point, you are not working as the root user.

Here's how to run the Linux su command:

Try all of the examples below to get real, practical commands training experience.

$ Su –

Be sure to use the – (dash) as shown at the right of the command above. This provides the "root user environment".

After running the command above, the prompt changes from $ (a dollar sign) to # (a number sign) to indicate that you are working "as the root user" and not "as a regular user".

Now you can run Linux System Administration commands.

To "go back" to working as a "regular" user, run the Linux exit command:

$ Exit , and

Linux Commands Training Tips: When you run commands, you are running them "in the bash shell" (environment) and when you run the su command (with the dash option) to work as the root user, you're actually opening a " subshell "inside of the" bash shell ".

When you run the exit command, you're "exiting" out of the subshell (as the root user) to the "regular" shell!

Debian Linux is a "major" Linux distribution and the following distributions are "based on" or "derived from" this version – and so the examples above will work on the following distributions as well:

Ubuntu, Damn Small Linux, Dreamlinux, Kanotix, Knoppix, LinEx, Linspire, Mepis, Sidux, Xandros – and many more!


Leave a Reply