Linux Commands Reference - Complete Linux Command Guide

Comprehensive Linux command reference with 150+ commands. Search, filter by category, and view detailed usage examples.

Share
Back to commands

sudo

Execute command as another user

Syntax

sudo [OPTION]... COMMAND

Common Options

-uExecute as specified user
-iSimulate initial login
-sRun shell as root
-lList sudo privileges
-kInvalidate timestamp
-vUpdate timestamp
-bRun in background
-EPreserve environment

Common Examples

sudo apt update

Update packages as root

sudo -u postgres psql

Execute as postgres user

sudo -i

Switch to root shell

sudo -l

Check sudo privileges

sudo -s

Run shell as root

sudo -k

Invalidate sudo cache

Related Commands

Related Tools

More Code & Dev Tools