Skip to content
Related Articles

Related Articles

Difference Between su and su – Command in Linux
  • Difficulty Level : Basic
  • Last Updated : 15 Mar, 2021

As a new Linux user, you may always face confusion regarding the difference between su command and su – command. But before knowing about the difference between su and su – command, we need to make ourselves familiar with Linux User Environment 

Linux User Environment: Linux’s systems are multi-user environments. Whenever Linux operating system creates a new shell session(after a new terminal being started on Linux) it started preparing an environment for itself. This environment basically holds the Environment variable(Environmental depends on shell type, Bash is generally used by most of the Linux distribution).

For example, pwd command is an environmental variable.

Linux User Environment (pwd command shown)

The major difference between su & su – command

su command is an abbreviation for “substitute user” because it is used for switching to another user during a normal login session, but it is often mistaken as an abbreviation for “super user” as mainly su command is used for getting “super user” privileges as when su command is run without a username, we automatically become the superuser after giving the correct root password and after that, we will enter root’s default environment, by only typing the following command:


give the root user password

Now logged in as root user/super user

root user

Directory Differences between su & su –

When we switch from one user to another user using the normal su command the current directory remains the same as of the previous user like this

Directory Differences between su & su:Directory Differences between su & su:

When we switch from one user to another user using su — command the current directory changes to the home directory of the target user like this:

Directory Differences between su & su:

Path Differences

su command does not create a new User Environment (in the simple term they pretends to be the target user) but su — creates a totally new User Environment (in the simple term they are actually the target user) that we can check with environment variables like:

echo $PATH

For su command


For su – command



For more info check the su manual by typing:

man su

Directory Differences between su & su:

My Personal Notes arrow_drop_up
Recommended Articles
Page :