How to enable Linux sudo on Windows 11

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.
  • Input closed: 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.

Enable sudo on Windows 11 from Settings

To enable sudo on Windows 11 through the Settings app, use these steps:

  1. Open Settings on Windows 11.
  2. Click on System.
  3. Click the For developers page.
  4. Turn on the Enable sudo toggle switch.

    Windows 11 enable sudo

  5. Click the “Enable sudo” setting.
  6. Choose the “Inline” mode from the “Configure how sudo runs applications” setting for a Linux-like experience.

    Configure how sudo runs apps

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:

  1. Open Start.
  2. 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.

  3. Type the following command to enable sudo “Inline” mode on Windows 11 and press Enter:
    sudo config --enable normal

    Command Prompt enable sudo command

  4. (Optional) Type the following command to enable sudo “In a new window” mode and press Enter:
    sudo config --enable forceNewWindow
  5. (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.

  1. Open Start.
  2. Search for Windows Terminal and click the top result to open the console.
  3. Type the following command to invoke the sudo command help and press Enter:
    sudo -h

    Sudo help command

    Quick note: This command will help you learn how to structure the command, the different arguments, and the available options.

  4. Type the following command to run a command with sudo on Windows 11 and press Enter:
    sudo del mytextfile.txt

    Using sudo command correctly

    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.