📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Linux Command Line sudo and Root

sudo and Root

4 min read
sudo runs commands with root privileges. Always allow SSH before adding restrictive sudo rules to avoid lockout. Edit sudoers only with visudo. Grant the minimum permissions needed — avoid full sudo access.

sudo — Superuser Commands

sudo apt update         # run as root
sudo !!                 # repeat last command as root
sudo -i                 # open root shell (be careful!)
sudo -l                 # list allowed commands

# /etc/sudoers — configure sudo access
sudo visudo             # safely edit sudoers

# alice ALL=(ALL:ALL) ALL  — give alice full sudo