OnCallReady

Commands

sudo - execute a command as another user

sudo [-u user] [-i] [-s] [-k] [-l] command [args]

Options you will use

-u user
Run the command as user instead of root.
-i
Run a login shell as the target user (fresh environment, target user HOME).
-s
Run a shell as the target user, keeping most of the current environment.
-k
Invalidate the cached credentials; the next sudo asks for a password again.
-l
List the commands the invoking user is allowed to run.
-v
Refresh the cached credentials (asks for the password if needed) without running a command.

Examples

$ sudo systemctl restart nginx

run one privileged command

$ sudo !!

re-run the previous command with sudo

$ echo "x" | sudo tee /etc/foo

write to a root-owned file (redirection would NOT work)

Gotchas

Taught in

Try sudo in a real terminal Free, in your browser - a real Ubuntu terminal to try it in, with missions that check your work.