explaingit

gerardog/gsudo

5,951C#Audience · developerComplexity · 2/5Setup · easy

TLDR

gsudo is a Windows utility that lets you run any terminal command with administrator permissions by prefixing it with 'gsudo', just like sudo works on Linux and macOS, no separate elevated window needed.

Mindmap

mindmap
  root((gsudo))
    What it does
      Run as admin
      Same terminal window
      UAC once
    Shell support
      CMD
      PowerShell
      WSL
      Git-Bash
    Features
      gsudo !!
      Session cache
      Exit codes
    Install
      Scoop
      WinGet
      Chocolatey
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Run elevated Windows terminal commands without opening a separate admin window by typing 'gsudo' before any command

USE CASE 2

Use gsudo in scripts to automate privileged tasks and check success via exit codes

USE CASE 3

Re-run the last command with admin rights instantly using 'gsudo !!' without retyping it

USE CASE 4

Reduce repeated UAC popups during a session by enabling gsudo's optional credential cache

Tech stack

C#.NETWindows

Getting it running

Difficulty · easy Time to first run · 5min

Windows-only, install via Scoop, WinGet, Chocolatey, or MSI, no background services.

In plain English

gsudo is a Windows version of the Unix/Linux command called "sudo." On Linux and macOS, sudo lets you prefix any command with the word "sudo" to run it with administrator-level permissions. Windows has always lacked a built-in equivalent, requiring users to right-click and choose "Run as administrator" or open a separate elevated terminal window. gsudo adds that missing behavior to Windows. With gsudo installed, you type "gsudo" (or "sudo" using the alias it creates) before any command in your terminal, and that command runs with administrator rights. A Windows UAC confirmation popup appears once. There is an optional cache feature that, if you enable it, reduces how often those popups appear during a session by remembering that you already confirmed once. The tool works inside the same terminal window you are already using, rather than opening a new one. It detects which shell you are running (CMD, PowerShell, WSL, Git-Bash, and several others) and adjusts its behavior accordingly. You can also use it in scripts, pipe its output to other commands, and check whether the command succeeded via exit codes. A shortcut called "gsudo !!" re-runs the last command you typed with elevated permissions. Installation is available through several Windows package managers including Scoop, WinGet, and Chocolatey, or via a downloadable MSI installer from the releases page. There is also a portable version that requires no system-wide installation. The tool itself is a single executable that does not install any background services. gsudo is aimed at developers and technical users who frequently need to run elevated commands from the terminal and want the same quick workflow that sudo provides on Unix systems. It is a command-line tool with no graphical interface of its own.

Copy-paste prompts

Prompt 1
Show me how to install gsudo via Scoop and set up the sudo alias so I can use it like Linux sudo in PowerShell
Prompt 2
Write a PowerShell script that uses gsudo to restart a Windows service, capturing the exit code to verify success
Prompt 3
How do I enable the gsudo session cache so I only get one UAC popup per terminal session instead of one per command?
Prompt 4
What are the behavioral differences when running gsudo inside CMD versus PowerShell versus WSL and what limitations apply to each shell?
Prompt 5
How do I use gsudo in a CI pipeline or automated script to run elevated commands without any interactive UAC prompt?
Open on GitHub → Explain another repo

← gerardog on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.