--- layout: page category-page: intermediate category-title: Intermediate commands tags: super user admin execute root author: Joao Tomazoni title: sudo previous-page: pages/cmd/interm/strings.html next-page: pages/cmd/interm/sync.html --- sudo stands for Substitute User DO or SuperUser DO.
It's a powerful command that you must handle with great care. If you are a member of the proper group and have permission to do sudo commands than you can execute commands as if you were the root user. Say you're an administrator in the users folder, and you would like to see a subfolder inside the home folder from another user named Nate, you may attempt to use the command: ls -lr Nate, but you will come by a whole bunch of permissions denied messages, this happens because even-though you're an administrator, you don't have the rights or permissions to get inside of Nate's home folder and look inside those subfolders. That's where the sudo command comes in:
ls -lr Nate
Returns denied access messages. To fix this, proceed to add sudo before the previously inserted command:
sudo ls -lr Nate
    Password: (type the local administrator password)
Now, Instead of the denied messages now you actually get a listing of all those subfolders in Nate's home folder. So you can execute commands temporarily as if you were the root user, which can do absolutely anything on the system. It's is very powerful to troubleshooting or fixing problems.

Flags

-s: If you're going to execute a lot of commands with sudo, you can go inside the root shell using the flag -s, so that you won't need to keep typing sudo over and over again. By typing whoami command after typing sudo -s should return you "root". This is what it look likes:

sudo -s
Password: (type the local administrator password)
whoami
    root
Remember, with great power comes great responsibility, be careful with sudo commands.
xkcd 146