Monday, December 29

You can use “sudo” on Windows 11 now — and it’s more useful than I thought


If you’re anything like me, your fingers have a mind of their own. You spend your day bouncing between OSes—a Linux server for the home lab, a Windows rig for gaming and daily use. Over time, your muscle memory calcifies around certain commands. The most persistent one? sudo.

For years, I’d accidentally type sudo in a Windows Command Prompt or PowerShell window and immediately be greeted with an error message. And even though Microsoft’s Windows Terminal updates have quietly made it incredible, an easy way to run an elevated process through the command prompt was missing.

That’s not the case anymore; you can use sudo on Windows 11 now. All you need to do is enable a few toggles, and you can enjoy one of the smallest but perhaps most significant workflow improvements to hit Windows in years.

You need to enable sudo for Windows 11 first

Enabling sudo in Windows 11 takes seconds, but it’s easy to miss

Sudo on Windows isn’t enabled by default. Microsoft has tucked away the the option in the Windows Settings app, likely to keep casual users from accidentally nuking their System32 folder.

To turn it on, follow these steps:

  1. Open Windows Settings and head to the System tab. Click Advanced to proceed.
  2. Scroll down to find the Enable sudo slider. Toggle the slider to enable sudo on Windows.

That’s not all. Microsoft also lets you choose how sudo runs applications on Windows. There are three options at the moment:

  • In a new window: This is the default option where sudo launches a completely new terminal window to run the requested command.
  • With input disabled: This runs the command in your current window but refuses to accept any input. Good for security, but bad for interactivity.
  • Inline: Mimics the behavior we’ve come to expect when typing sudo from Linux and macOS. You type the command, it runs in your current window as expected.

I switched to Inline instantly. For the command-line purists, you can also do this by running the following command from an elevated terminal window:

Sudo configuration command in Windows terminal.
Yadullah Abidi / MakeUseOf
Credit: Yadullah Abidi / MakeUseOf

sudo config --enable normal

Once you’ve enabled sudo and configured how you want it to run applications, you’re good to go. You can now type sudo followed by a Windows terminal command and it’ll run the process with admin privileges. Keep in mind that you will see a UAC (User Access Control) window asking for permission every time you use sudo.

Sudo on Windows is more than a gimmick

It’s not just a novelty—this changes how you use the terminal

One of my favorite use cases for sudo on Windows is with Winget. Usually, when you try to update all your installed packges at once using Winget, you’re bound to get some failed apps because they require admin privileges to write to the Program Files folder.

With sudo, I can run sudo winget upgrade –all, click yes on the UAC prompt, and watch my entire app library get updated automatically.

That’s how I use sudo most of the time with Windows. A lot of built-in Windows tools like netstat, diskpart, or sfc require an elevated terminal window. Previously, I’d have to open another elevated window if I wasn’t already in one to run these commands. Now, I can just prefix sudo before running them and not have two or more terminal windows for the same job.

It’s also rather helpful when editing system configuration files. For example, if you need to make a change to the Windows hosts file, you’d have to open a new elevated terminal window, navigate to the file, and only then you’d be able to edit it. The other alternative was to open Notepad with admin privileges and browse for the file.

With sudo, I can just type:

sudo notepad C:\Windows\System32\drivers\etc\host

This opens Notepad with admin rights. You can make your edit, save the file, and close Notepad. That’s it. You never leave your terminal context.

Don’t expect Linux-style sudo

Similar name, different rules, and some important limitations

There are caveats, of course. It’s Microsoft we’re talking about. And if you’re coming from Linux, you’ll notice the difference immediately.

Even though sudo is doing the same thing on Windows and Linux, it works differently. On Windows, using sudo triggers a UAC prompt. It’s a different security model. Instead of running the command as a root user, Windows is just elevating that particular process.

Sudo UAC prompt on Windows 11.
Yadullah Abidi / MakeUseOf
Credit: Yadullah Abidi / MakeUseOf

Additionally, the implementation itself is rather basic. Unlike Linux, using sudo on Windows doesn’t cache your credentials. On Linux, if you type sudo once, you usually have a five to ten minute grace period before you’re asked for your password again. Windows, on the other hand, will show you a UAC prompt every time.

Windows terminal in PowerToys Command Palette.


You need to start using this hidden Windows Terminal feature

Stop wasting clicks. This hidden Windows Terminal feature lets you open the terminal instantly, no matter what you’re doing.

This is where third-party tools like gsudo, a community-built tool that inspired Microsoft’s feature can come in handy. Gsudo offers credential caching and more granular security controls. So if you’re a power user constantly using the Windows terminal, gsudo might still be the better option.

The Windows command line finally feels less painful

Small quality-of-life upgrades add up fast

Sudo’s arrival to Windows is almost symbolic. It shows that Microsoft is finally understanding its target audience, and actually trying to appeal to developers who grew up on Bash and Zsh. They aren’t trying to force us to do things the Windows way as strictly as they used to, and that’s one of the reasons why my dream developer setup isn’t on Linux.

It is a small command, and for the vast majority of Windows users, totally inconsequential. But being able to finally run elevated commands without spamming a dozen mouse clicks is a quality-of-life upgrade much more useful than the AI features that Microsoft wants to cram in every corner of Windows.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *