Linux Tutorial Series

Linux Tutorial Series – 47 – The su command

Here is the video version, if you prefer it:

The su command is used to start a shell as another user (most often the superuser). (Shotts, 2019)⁠ If you want to use it, this is what you’d write:

su [-[l]] [user]

This is some new notation? What does this mean? Everything enclosed in square braces is optional, meaning you can execute the command without writing any of it. (Barrett, 2016)⁠ Couple of examples of valid commands:


su -

su -l

su -l mislav

su - mislav

su mislav

All are valid. If you don’t specify the user it is assumed you want to start the shell as the superuser. The -l option means you want to change to that user’s home directory. To enter the previous shell, type exit.

The -c option is used to execute a command as another user like so:

su -c 'command'

but I have never used it. In general, I have never found myself using the su command – whenever I want to do something as the superuser, I use sudo.

A caveat: If you switch to the superuser, your prompt will change from $ to #, like so:

mislav@mislavovo-racunalo:~$ su



Hope you found this useful!


Barrett, D. J. (2016). Linux pocket guide (3rd ed.). O’Reilly Media. Pages 171-172

Shotts, W. (2019). The Linux Command Line, Fifth Internet Edition. Retrieved from Pages 126-127