Windows
Linux
Security & Permissions
System
Windows runas equivalent in Linux
Executes a command with elevated privileges (as root/superuser).
Windows
→
runas
Linux equivalents
sudo
sudo
sudo
Overview
What this command does
Executes a command with elevated privileges (as root/superuser).
Migration tip:
sudo stands for "superuser do". It's like Windows UAC — you get elevated permissions for one command. sudo su or sudo -i opens a root shell (use sparingly).Practical tasks
Common use cases
Run command as administrator
Executes a command with elevated privileges (as root/superuser).
sudo command
Run one command as root
sudo -i
Open an interactive root shell
sudo su
Switch to root user
Ready to run
Copyable Linux commands
Review paths, device names, package names and permissions before running any command.
sudo apt update
sudo systemctl restart nginx
sudo !!
sudo -i
Walkthrough
Examples with explanations
# Windows: runas /user:Administrator cmd.exe
sudo apt update # update package list (needs root)
sudo systemctl restart nginx # restart a service
# Forgot sudo? Re-run last command with sudo:
sudo !! # very useful shortcut
# Open root shell:
sudo -i # root shell (prompt changes to #)
Reference
Common options and variations
| Command or option | Use |
|---|---|
sudo command | Run one command as root |
sudo -i | Open an interactive root shell |
sudo su | Switch to root user |
sudo !! | Re-run last command with sudo |
sudo -l | List what you're allowed to sudo |
Distro differences
Debian/Ubuntu vs Fedora vs Arch
This command is the same on Debian/Ubuntu, Fedora and Arch Linux when the relevant tool is installed.
| Distribution | Package manager / base | Equivalent command | Difference to notice |
|---|---|---|---|
| Debian/Ubuntu | same command | sudo |
Same command on this distribution. |
| Fedora | same command | sudo |
Same command on this distribution. |
| Arch | same command | sudo |
Same command on this distribution. |
Important
What to watch out for
Don't stay in a root shell longer than needed. It's easy to accidentally damage your system. Use sudo per-command instead.
Keep learning