User Management

sudo

Execute a command as another user, typically root, with privilege elevation.

Synopsis

syntax
sudo [OPTION]... COMMAND

Examples

Run package update as root
sudo apt update
Run command as www-data user
sudo -u www-data whoami
Open root login shell
sudo -i
List commands you're allowed to run
sudo -l
Run preserving current environment
sudo -E ./script.sh

Common options

FlagDescription
-uRun as specified user
-iLogin shell (simulate initial login)
-sRun shell
-lList allowed commands
-kInvalidate cached credentials
-EPreserve environment variables

About sudo

The `sudo` command execute a command as another user, typically root, with privilege elevation. User management commands handle creation, modification, and deletion of user accounts and groups.

Multi-user access control is a core feature of Linux. These commands are essential for system administrators managing servers, enforcing security policies, and provisioning access for teams.

The command accepts 6 commonly used flags shown above, though the full set of options is available in the man page (`man sudo`). The 5 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More User Management Commands

Other commands in the User Management category

Related tools