Windows runas equivalent in Linux
Executes a command with elevated privileges (as root/superuser).
runas
sudo
sudo
sudo
Overview
What this command does
On Windows, "runas" is used to run command as administrator. On Linux, the closest practical mapping shown here is "sudo". Executes a command with elevated privileges (as root/superuser). This reference is grouped under Security & Permissions → System.
Windows → Linux context
What changes when you use this on Linux?
Equivalent task, different tool
Windows runas maps to sudo for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.
Portable across the compared distros
The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.
Command-specific caution
Don't stay in a root shell longer than needed. It's easy to accidentally damage your system. Use sudo per-command instead.
For the broader concept behind this mapping, read Linux permissions for Windows users.
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
Debian/Ubuntu, Fedora and Arch all use "sudo" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.
| 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
Keep learning