Forever & AlwaysLINUX COMMAND ATLAS

LINUX COMMAND ATLAS · COMMAND GUIDE

Linux sudo command

Run an approved command with elevated privileges. Check the command before confirming.

sudo manual

Syntax

Command form
sudo [OPTION]... COMMAND [ARGUMENT...]

Common options

7 options
OptionWhat it does
-u USER, --user=USERRun the command as USER.
-g GROUP, --group=GROUPRun the command with GROUP as the primary group.
-i, --loginStart a login shell as the target user.
-s, --shellRun the configured shell as the target user.
-l, --listList allowed commands or privileges.
-kInvalidate cached credentials.
-vRefresh the credential timestamp without running a command.

Usage examples

2 examples

Run an approved command with elevated privileges. Check the command before confirming.

sudo systemctl status ssh

Run id as the www-data account.

sudo -u www-data id

Notes

Review the full command before confirming. Use the least privilege needed; sudo policy and available flags are administrator-configured.