The 
su command is used to switch to another user, in other words, change user ID during a normal login session (that is why it is sometimes referred to as switch (-) user by a number of Linux users). If executed without a username, for example, su - it will log in as root user by default.

Following command, then you will be prompted for the password of the user you’re switching to.

$ su ucartz


When you invoke su with a -, or -l or --login flags, it offers you a login interface similar to when you are logging on normally. All the commands below are equivalent to each other.

$ su - ucartz
OR
$ su  -l ucartz
OR
$ su --login ucartz


When you run su without a username, you will automatically become the superuser. You will be given root’s default environment, including the path to executable files changes. You will also land into root’s home directory:

$ su


Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $131.99 a month.

Was this answer helpful?

Still stuck? Open a ticket