- To enable sudo on Windows 11, open Settings > System > For developers, turn on “Enable sudo,” and choose the “Inline” option.
- You can also open Command Prompt or PowerShell (admin) and run the “sudo config –enable normal” command.
On Windows 11, it’s now possible to enable “sudo,” and in this guide, I will outline the steps to complete this configuration. Starting with the preview build 26052, the operating system adds support for the sudo command for Command Prompt and PowerShell to run elevated commands without having to open the console as an administrator, similar to the command already available in Linux, macOS, and other Unix-based operating systems.
Sudo modes differences
Sudo on Windows 11 offers three modes:
- Inline: When running the sudo command, the console will allow the execution of administrative tasks within the same window. If you want the same Linux experience, this is the option you have to use.
- With input disabled: This is the most secure experience. It runs the command in an elevated mode in the current window, but the process won’t have any more inputs. If you need to run additional processes, this mode won’t work.
- In a new window: When running the sudo command, the Terminal will open a new window as an administrator.
Supported operations
You can perform many operations using this command:
- Deleting a protected file.
- Invoking elevated commands.
- Opening a new terminal to perform any task.
Requirements
The integration of sudo is currently under development, meaning that you will need a device enrolled in the Dev or Canary Channel, and it has to be running Windows 11 build 26052 or higher release. Technically, this feature is expected to roll out as part of the Windows 11 24H2.
In this guide, I will teach you the steps to configure the sudo command on Windows 11. You can also bring the same Linux Sudo experience to version 23H2, 22H2, and Windows 10 with the gsudo tool.
- Enable sudo on Windows 11 from Settings
- Enable sudo on Windows 11 from Terminal
- Get started using sudo on Windows 11
Enable sudo on Windows 11 from Settings
To enable sudo on Windows 11 through the Settings app, use these steps:
-
Open Settings on Windows 11.
-
Click on System.
-
Click the For developers page.
-
Turn on the Enable sudo toggle switch.
-
Click the “Enable sudo” setting.
-
Choose the “Inline” mode from the “Configure how sudo runs applications” setting for a Linux-like experience.
Once you complete the steps, you can start using the sudo command on the Windows Terminal whether you use Command Prompt or PowerShell.
Enable sudo on Windows 11 from Terminal
To turn on the sudo command through Command Prompt or PowerShell, use these steps:
-
Open Start.
-
Search for Windows Terminal, right-click the top result, and choose the Run as administrator option.
Quick note: This would be the last time you will need to run the Terminal as admin. You can process the configuration in Command Prompt or PowerShell. -
Type the following command to enable sudo “Inline” mode on Windows 11 and press Enter:
sudo config --enable normal
-
(Optional) Type the following command to enable sudo “In a new window” mode and press Enter:
sudo config --enable forceNewWindow
-
(Optional) Type the following command to enable sudo “With input disabled” mode and press Enter:
sudo config --enable disableInput
After you complete the steps, the sudo command will enable, and you can start using the command to run tools elevated without the need to start a console as an administrator.
Get started using sudo on Windows 11
To use the sudo command, use these steps.
-
Open Start.
-
Search for Windows Terminal and click the top result to open the console.
-
Type the following command to invoke the sudo command help and press Enter:
sudo -h
Quick note: This command will help you learn how to structure the command, the different arguments, and the available options. -
Type the following command to run a command with sudo on Windows 11 and press Enter:
sudo del mytextfile.txt
Quick note: The command works by appending the sudo prefix before the actual command to elevate the process. The system would still show the “User Account Control” (UAC) dialog to confirm the elevation.
It’s important to note that the sudo command is case-sensitive but only for the available options. For example, sudo -h
will bring up the help, but the sudo -H
will produce an error.
Microsoft is adding this native support further to bridge the gap between Windows and Unix-like operating systems and make it easier for developers to work in the system with tools they already know.
If you already configured the Windows Terminal to start a command-line session as an administrator, you can still use the Sudo command, but it will make no difference since all the commands will already run elevated.