Permissions & SecurityCLI Reference
$sudo
Execute a command with superuser (root) security privileges.
Syntax DefinitionPOSIX standard
sudo [OPTIONS] COMMANDTry `sudo` Live in Interactive Sandbox
Zero-install client simulation with real-time feedback.
bash — terminal
AST Sandbox (Free)
Overview & How sudo Works
`sudo` (SuperUser DO) allows authorized users to execute sensitive system administration commands with root privileges according to the `/etc/sudoers` policy.
Common Flags & Command Options
| Flag / Option | Description |
|---|---|
| -i, --login | Launch an interactive login shell as the root user. |
| -u [user] | Run command as a specified user instead of root. |
| -l | List allowed and forbidden commands for the invoking user. |
Practical Real-World Examples
Example #1Update system package index as root
sudo apt updateElevates privileges to refresh package repositories.
Frequently Asked Questions
What is the difference between sudo and su?
`sudo` runs an individual command with root privileges using your own password. `su` switches your entire shell session to root or another user and requires that target user password.