WinuxCmd: native Unix commands for Windows
One native Win32 executable that speaks GNU syntax and walks real Windows paths: 176 commands, 1,924 options, a single 3.79 MB file. No WSL, no Cygwin, no MSYS2, no path-translation pain — it is the command half of the niubash workflow: the shell provides the language, WinuxCmd provides the commands.
github.com/unixwin/WinuxCmd ↗ 274 stars (repo-meta.json, measured 2026-10-19)
Why WinuxCmd
Typing grep -rn, sed -i, find -exec,
xargs -0 on Windows used to mean choosing a compromise. WinuxCmd's stance is to
skip the compromise: it does not emulate Unix — it implements GNU's invocation surface on Win32.
中文原文 · Chinese original(4 张对照卡全文)
- 不是虚拟机(vs WSL)——WSL 给你 1 GB+ 安装与一道 VM 文件系统边界;WinuxCmd 是一个原生 Win32 可执行文件,直接操作你的真实文件。
- 不是模拟层(vs Cygwin)——Cygwin 要你做路径翻译体操、付 2–5 秒启动;WinuxCmd 理解 C:\ 与 UNC 原生形态,冷启动约 19 ms,无运行时 DLL。
- 不是 2012 年的遗物(vs GnuWin32)——GnuWin32 停止维护于 2012 年、兼容度停在 60%;WinuxCmd 的差分语料 178 例对 GNU coreutils 9.7 oracle 实测 93% 通过。
- 不止 ~100 命令(vs uutils)——同为原生命令集的 uutils 覆盖约 100 命令 / ~600 选项;WinuxCmd 携带 176 命令 / 1,924 选项,单文件 3.79 MB。
Core features
Native rather than emulated (Win32 APIs, C:\ and UNC paths, NTFS ACLs); the critical GNU bits
delivered (find with 88 options, grep with 49 incl. PCRE2, in-place
sed -i); dual-dialect paths; i18n message catalogues; zero-glue niubash
integration; PGO release builds. Full eight-point list (Chinese):
中文原文 · Chinese original(八条特性全文)
- 原生而非模拟——直接调用 Win32 API:理解 C:\、D:/、UNC 路径与 NTFS ACL(配 cygpath / getfacl 桥接),无 VM、无运行时 DLL、即时启动。
- GNU 关键位全给——find 一个命令实现 88 个选项(完整表达式解析器、-exec/-execdir/-ok/-printf);grep 49 选项含 PCRE2;sed 支持就地 -i 编辑。
- 176 命令 / 1,924 选项——Coreutils 83 + findutils/grep/sed + BSD 工具 15 + 进程管理 13 + Cygwin/MSYS 桥 14 + 系统信息 16 + 自有扩展 10+。
- wpm 内建——不该重造的工具(jq、ripgrep、fd、fzf、bat、make、neovim、curl、wget…)用内建包管理器一键装真发行版。
- 双方言路径——POSIX 写法(/d/repo、/cygdrive/d、/mnt/d)与 Windows 原生写法(D:\repo)全部接受且真实折叠。
- 中文输出(i18n)——消息目录经 wpm 安装(winuxcmd-i18n-zh-cn),WINUX_LANG 优先、回落 LC_ALL/LC_MESSAGES/LANG。
- 与 niubash 零胶水——niubash 启动时把 WinuxCmd 的命令链接注入 PATH——shell 里敲的 grep/sed/find 就是这枚二进制。
- PGO 发布档——公开 x64 二进制按真实负载做 Profile-Guided Optimization 训练:sort −18%、nl −17%。
Install & quick start
The niubash Windows installer ships a complete WinuxCmd root (preinstalled) —
installed under {app}\winuxcmd\ with PATH pointing at
winuxcmd\bin; installing niubash gives you all
176 commands and built-in wpm. Standalone installs are for users without niubash: grab the
installer from GitHub Releases (WinuxCmd-<version>-x64-setup.exe, plus ARM64
and a portable zip); an existing installation self-updates via the built-in wpm — all three
roads land on the same winuxcmd.exe.
Already have WinuxCmd? Update it with wpm (built into the binary itself):
wpm update winuxcmd First-run orientation
# Open a fresh terminal (so PATH takes effect), then:
winuxcmd --version # confirm the active binary and version
ls --help # the GNU help surface of any command
winuxcmd --list-all # flat list of all 176 commands (bare winuxcmd groups coreutils-style)
wpm index update # refresh the package index (wpm is built in; see /en/products/wpm/)
Chinese output: install the message catalogue and declare the language
(wpm install winuxcmd-i18n-zh-cn, then export WINUX_LANG=zh-CN;
without a catalogue, non-English locales get a one-line hint, #1155). Building from source
needs VS 2022 + CMake 3.30 + Ninja, entry scripts/build-with-vs.ps1; reproduce PGO
with scripts/build-pgo.ps1.
Deep dive: command coverage and categories
The 176 commands are grouped coreutils-style (bare winuxcmd prints the grouped
list; --list-all prints it flat); the 1,924-option total counts OPTION(
macros under src/commands/, excluding the built-in wpm and the [ alias.
| Category | Count | Representative commands |
|---|---|---|
| GNU Coreutils | 83 | cp mv rm ln mkdir touch · cat head tail sort uniq cut tr wc · ls dir vdir · base64 md5sum sha256sum cksum · date seq expr env … |
| findutils / grep / sed | 3 | find (88 options), grep (49 options, PCRE2), sed (17 options, in-place -i) |
| BSD tools | 15 | cal column hexdump logger tree less more strings rev watch tput … |
| Process management | 13 | ps top kill killall pgrep pkill pidof pldd free uptime renice stdbuf timeout |
| Cygwin / MSYS2 bridge | 14 | cygpath dos2unix unix2dos d2u u2d … (migration-era spelling compatibility) |
| System information | 16 | hostname id who pinky stty locale getconf getfacl ldd lsof file man … |
| First-party extensions | 10+ | wpm (package manager) mpicalc regtool mkpasswd mkgroup mkfifo mknod clear reset tzset |
Source: the WinuxCmd README "Command coverage" (expandable full table) and
DOCS/en/command_compatibility_matrix.md (per-command status for all 176).
中文原文 · Chinese original(差分测试 / i18n / PATH 注入 / 路径方言 四节全文)
差分测试:93% 是怎么来的——178 例差分语料(131 语料 + 47 回归,覆盖 84 个命令)以相同输入对 GNU coreutils 9.7、findutils 4.10.0、grep 3.12、sed 4.9、patch 2.7.6、util-linux 2.41、procps-ng 4.0.4 逐字节比对——165 例通过、13 例为实名在册的平台差异(93%),机器校验落在 tests/differential/baseline.json。13 例不是雾里的「有时不一样」:id -g 打印主组 RID、跨 \wsl.localhost 9p 的硬链、mkdir 报错引号形态。CI 里每个 PR 都对 GNU master 跑同一差分。
i18n 与 WINUX_LANG——语言选择器优先级:WINUX_LANG → LC_ALL → LC_MESSAGES → LANG(src/utils/i18n.cppm,#1155);消息目录定位在安装根;WINUX_LANG=off 整体关闭。
与 niubash 的 PATH 注入联动——niu 启动时把 WinuxCmd 的命令链接注入 PATH;捆绑的 WinuxCmd coreutils「拥有 shell 树」(niubash#346 的 Windows 路径契约)——原样接收 shell 的 POSIX 写法并在子进程内自行解析,其余子进程一律收到原生 Windows 路径。
路径方言能力链——/d/repo(MSYS 单字母形)、/cygdrive/d(Cygwin 形,#1145)、/mnt/d(WSL 形按 interop 折叠,#1172)。方言 × 层的全量实测矩阵见 路径与 MSYS。
Measured numbers
| Metric | Value | Source |
|---|---|---|
| Single-file size | 3.79 MB (carrying 176 commands / 1,924 options; statically linked, zero dependencies) | WinuxCmd README.md:74 |
| Cold start | ~19 ms | WinuxCmd README.md:74 |
| PGO gains | sort −18% · nl −17% (x64 release builds, trained on real workloads) | WinuxCmd README.md:74 · scripts/build-pgo.ps1 |
| Quality gates | 178-case differential 93% (165 pass / 13 platform deltas named on record) · 2,420 unit tests 99.6% | README.md · tests/differential/baseline.json |
| Workload contrasts | cat 100 MB 0.8 s · sort 1M lines 2.1 s · grep 100 MB 1.2 s · find 10K files 0.3 s (~10–15% behind GNU/WSL2) | README.md Benchmarks (Win11 · i7-13700K · 32 GB · NVMe) |
More figures (git startup ~14 ms, one-shot execution 26.3 ms and other niubash-family numbers) on the benchmarks page.
Release feed
Latest 3 versions (changelogs.json, fetched 2026-10-19; the full feed lives on the changelog):
- Unreleased (release line, no date stamped)
WSL interop paths:
/mnt/X/…operands fold in the same shape as/X/…andX:\…(#1172, byte-aligned with rubash'swindows_mnt_drive_argument); latest release tag is v1.1.15 (repo-meta.json, measured 2026-10-19; Releases ship x64/ARM64 setup.exe plus a portable zip). - v1.1.14 (2026-10-17)
wpm:
links verifyreports per-path links not pointing at the current winuxcmd.exe; thewinuxcmd-shim.exemini-forwarder cuts shim dispatch from 24.5 ms to 12.1 ms;wpm update winuxcmdno longer silently leaves command links on the old image; self-update rollback copies keep the newest two, auto-pruned. - v1.1.13 (2026-10-17)
wpm: files held by running processes upgrade via rename-aside — either complete or
untouched; forced-upgrade verified on a real install with 28
fsmonitor--daemonpayload holders;wpm clean staging/allalso clears parked.wpm-old-<pid>directories.
Related links
On this site
- Niubash product page — the other half of one workflow: the shell provides the language
- Rubash product page — the engine side of path dialects and the argv funnel
- wpm product page — the built-in package manager and official index
- Oh My Niu product page — themes and the plugin framework
- Paths & MSYS: the biggest behavioral difference
- Docs home · Benchmarks · Changelog
In the repo
FAQ
How does WinuxCmd differ from the Unix commands bundled with Git Bash?
WinuxCmd is a single native Win32 executable carrying 176 commands / 1,924 options (3.79 MB, zero DLLs). Git Bash provides similar commands through a ~440 MB MSYS emulation layer that rewrites path-looking arguments before spawn — WinuxCmd’s argv arrives byte-for-byte.
How fast is WinuxCmd?
About 19 ms cold start; with PGO builds sort is 18% faster and nl 17% (measured, per the README).
What does "GNU differential" mean?
Every PR automatically runs a 178-case differential against GNU coreutils 9.7 (131 corpus cases over 67 commands + 47 regressions): 93% pass, with all 13 tracked platform differences named in the ledger — command behavior is measured, not claimed.
How do wpm and WinuxCmd relate?
wpm is compiled straight into winuxcmd.exe (run as winuxcmd wpm) — zero runtime dependencies, no separate install step.
Is it free? Which platforms are supported?
Everything is open source and free. niubash ships native Windows x64 / arm64 installers (winget: Unixwin.Niubash); the rubash engine additionally has CI-gated builds for five platforms: Linux (gnu/musl), macOS, Android and OpenHarmony.