Why does a switch happens from $ to # after running the command sudo su in LINUX

Saran Kamandula
2 min readJun 28, 2024

--

Image source: Adobe Firefly

In Linux, whenever we run the command sudo su for an elevation in the privileges, there’s a switch in the prompt that we notice. It is a change from $ to #. This is mostly ignored by a Linux beginner, but it holds a meaning. First, it has a $ when the instance is launched, later, when the sudo is applied, it shifts to #

working directory at launch
before sudo su is executed

There is an identification for both the symbols.

$ for Regular User: The $ symbol indicates a regular user (ec2-user in this case) with limited privileges. This prompt allows the ec2-user to perform only limited level actions.

# for Root User: The # symbol indicates a root or an administrator. The root has complete control over the system and modification access.

after sudo su is executed

Why does it change with sudo su?

sudo su command switches from regular user to the root which means superuser do switch user.

sudo allows to execute everything at elevated privileges

su is switching to the root user

So, when it changes to #, it is a visual reminder that we are operating with utmost power in the system.

--

--

Saran Kamandula
Saran Kamandula

Written by Saran Kamandula

DevOps & Cloud Engineer | AWS Certified Solutions Architect | Linux Administrator

No responses yet