I saw some command such as sudo su ls, and I just wonder what's the deference between sudo ls?


1 Answer 1


In fact, the commands you mentioned perform two different tasks.

  • su is a program used to switch to another user. If you execute su <user> you start a shell session as another user.
  • sudo allows you to run a single command as the root user.
  • sudo su allows you to run su as the root. If you execute sudo su <user> you start a shell session as the user.


  • sudo su ls will start a shell as the ls user, if it exists.
  • sudo ls will list the content of directory just like if the command was issued by the root user.

If you are interested on two equivalent commands, you may consider...

sudo bash -c "ls"       # execute "ls" as the root
sudo ls                 # execute "ls" as the root
  • sudo allows you to do anything su can do, and more. su has been obsoleted by sudo. Commented Sep 18, 2017 at 7:57

Not the answer you're looking for? Browse other questions tagged .