sudo command allows you to run a Unix command as a different user. Using /etc/sudoers file to confirm what privileges are available to you, this command effectively elevates your access rights, thus allowing you to run commands and access files which would otherwise be not available to you.
Simplest usage is: sudo followed by the command you want to run as root. You’ll be asked for your password (not root’s password!) and if you are allowed to use sudo, it will work like this:
As you can see from the output, whoami command reports that it’s run by the user root (because sudo elevates your privileges).
There’s usually no need to type password for subsequent sudo commands in the same login session. So if you’re asked sudo once, you can execute multiple sudo commands in the same session and it won’t ask for your password again: