sudo allows you to run a Unix command as a different user. Many beginner users are asking for meaning of the sudo command, so here’s my take.
Using /etc/sudoers file to confirm what privileges are available to you, sudo command effectively elevates your access rights, thus allowing you to run commands and access files which would otherwise be not available to you. sudo runs these commands as root by default.
The meaning of sudo command is:
Unless specified, user is assumed to be root. So when you’re running some sommand using sudo, your specified command is executed as root.
Using one of the most basics examples: id command shows your current username, its user id (UID), group id (GID) and group membership:
When we’re running id using sudo, we’re asking sudo to first become user root and to then run the specified command (id) as root:
As you can see from the output, we get all the root information returned: UID =0, GID=0.