The “sudo” command, short for “superuser do,” is a valuable tool in Unix and Linux systems, allowing users to execute programs with elevated privileges without needing full administrative access. It enhances system security by reducing the need for constant administrator login and creating detailed logs of commands used. Microsoft has introduced this functionality to Windows 11.
Sudo is an alternative to the existing “RunAs” command in Windows, which requires entering a user’s password to run a program with their privileges. Although RunAs offers some similar functionality, sudo provides more comprehensive and flexible control over permissions and logging. Sudo allows for fine-grained permission delegation without full administrator rights.
Sudo is pre-installed in Windows 11 version 24H2 but must be activated manually. To do this, go to Settings > System > For developers, enable “Sudo,” and confirm the User Account Control message. Activation can also be done using the sudo command with various options.
Once enabled, use the sudo command followed by the desired program or command to run it with elevated privileges, such as “sudo netstat -ab.” The option “forceNewWindow” during activation helps recognize when a command runs with elevated rights.
Microsoft has implemented limited sudo functionality in Windows, so its current version is not identical to the Linux one.
Source: https://www.pcworld.com/article/2388945/windows-11-gets-the-sudo-command-from-linux-these-are-the-advantages.html