Online Linux Terminal Logo
OnlineLinuxTerminal
Permissions & SecurityCLI Reference

$sudo

Execute a command with superuser (root) security privileges.

Syntax DefinitionPOSIX standard
sudo [OPTIONS] COMMAND
Linux Community2.4k Online

Chat with real Linux users, learn new commands & get free cheat sheet PDFs.

Try `sudo` Live in Interactive Sandbox

Zero-install client simulation with real-time feedback.

Open in Fullscreen Workspace↗
bash — terminal

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 / OptionDescription
-i, --loginLaunch an interactive login shell as the root user.
-u [user]Run command as a specified user instead of root.
-lList allowed and forbidden commands for the invoking user.

Practical Real-World Examples

Example #1Update system package index as root
sudo apt update

Elevates 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.