sudo 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:
greys@maverick:~ $ sudo whoami Password: root
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:
greys@maverick:~ $ sudo whoami Password: root greys@maverick:~ $ sudo id uid=0(root) gid=0(wheel) groups=0(wheel),1(daemon),2(kmem),3(sys),4(tty),5(operator),8(procview),9(procmod),12(everyone),20(staff),29(certusers),61(localaccounts),80(admin),701(com.apple.sharepoint.group.1),33(_appstore),98(_lpadmin),100(_lpoperator),204(_developer),250(_analyticsusers),395(com.apple.access_ftp),398(com.apple.access_screensharing),399(com.apple.access_ssh)