unixwin/WinuxCmd
Sobre
Lightweight, native Windows implementation of Linux commands | 3.0MB only | AI-friendly
IA e aprendizado de máquinaCrescimento medido de estrelas
- em 24 h
- 0
- em 7 dias
- 0
- em 15 dias
- +2
- em 1 mês
- Coletando histórico
Variações líquidas em períodos sobrepostos, não totais diários. Medições ausentes ficam em branco. Estrelas indicam interesse, não qualidade.
README.md
OriginalReal Unix commands. Real Windows paths. One native executable. No WSL · No Cygwin · No MSYS2 · No path-translation pain v2.0.0 — the Rust command core is here. 🎉
unixwin.dev — Docs & downloads
💾 Install · 🚀 What's new in 2.0 · ⚡ Quickstart · 🔁 1.x → 2.0 · 📚 Docs · 中文
The problem, in one sentence
You're on Windows and you need grep -rn, sed -i, find -exec, xargs -0 — and every option so far is a compromise:
- WSL — 1 GB+ install, and a VM filesystem boundary between you and your files
- Cygwin — path-translation gymnastics and a 2–5 s startup
- GnuWin32 — abandoned in 2012, stuck at 60% compatibility
- uutils — a great Rust project, but ~100 commands and ~600 options
WinuxCmd skips the compromise. One native Win32 executable that speaks GNU syntax on Windows paths: 176 commands, no runtime, no VM. 2.0 moves the command core to Rust — behavior still measured against a GNU oracle, byte for byte.
🚀 What's new in 2.0
2.0 is an implementation release, not an interface release: the same commands, names, options, help surface and multicall binary. What changed is what runs underneath.
winuxcmd.exe (one image, one CRT)
├── C++ front end registration metadata, dispatcher, option policy,
│ help/version interception, wpm, retained faces
├── rust2_bridge the only C++ that touches the ABI
├── winuxcmd_ffi C ABI v2: winuxcmd_run / winuxcmd_run_stream
└── winux-cmds library-form commands
└── winux-core Io / Ctx / HostServices / path / regex seam
- Library-form commands — every wired applet is a function:
run(args, &mut Io, &Ctx) -> CmdResult. IO is injected, cwd and environment are explicit, there is no process-global mutable state, and a command returns a status instead of callingexit(). A panic becomes status 125 at the ABI boundary; it never unwinds into the dispatcher. - One image — the Rust side is a static library folded into
winuxcmd.exeby the same MSVC link. No DLL, no load-time CRT boundary, nothing extra to install. This is the fix for the FFI breakage that stalled the first Rust attempt (#1487). - Streaming stdin —
winuxcmd_run_streamfeeds input through a pull callback, so a command reads incrementally instead of slurping through the ABI. A host-stopped read returns GNU's 124; a read failure maps to the command's own status. winux-regex— a std-only BRE/ERE engine (GNU extensions, backreferences, POSIX leftmost-longest, glibc capture rules) shared bygrep/sed/find/tacand friends.grep -Pkeeps the existing pinned PCRE2 face; Perl syntax is not reimplemented.- Translation without globals — runtime messages carry stable keys and
English fallbacks; a translation is injected per invocation from the
catalog selected by
WINUX_LANG. English-only builds are the default. - A stricter gate — every wired command passes three gates: GNU oracle byte equality, an unchanged ctest failure set, and an old-vs-new exe byte matrix with each divergence explained.
At the 2.0 freeze, 50 applets run the Rust core, 32 more have a green
differential gate and are queued for the 2.0.x wiring waves, and the
remaining applets keep the 1.x core until their wave. The authoritative
per-command state is DOCS/2.0-inventory.tsv;
the architecture and wiring contract is
rust2/REPLACEMENT-RECIPE.md.
⚡ Quickstart
# Install one of the ways below, then use the commands directly:
ls -la
grep -rn "TODO" src/
sed -i 's/http:/https:/g' config.ini
find . -name "*.tmp" -exec rm {} \;
# Full pipelines, zero setup — command links land on your PATH,
# so there are no prefixes and nothing to configure
find . -name "*.cpp" -print0 | xargs -0 wc -l
# Every applet is reachable through the multicall binary too:
winuxcmd grep -c ERROR app.log
winuxcmd --list-all
# Tools that should not be reimplemented install through WPM:
wpm install jq
Verify what you are running:
winuxcmd --version
winuxcmd <command> --help
Install
| winget | winget install WinuxCmd (ID caomengxuan666.WinuxCmd) |
| Installer (recommended) | WinuxCmd-<version>-x64-setup.exe (or the ARM64 setup) from GitHub Releases |
| Portable | Unzip WinuxCmd-<version>-win-x64.zip anywhere and add it to your PATH |
| Build from source | VS 2022 + CMake 3.30 + Ninja + Rust — see Building from source |
🔁 Upgrading from 1.x
The command set is unchanged. The behavior is GNU-truer where 1.x had invented things. Read the full migration guide before upgrading scripts; the short version:
| Area | 1.x | 2.0 |
|---|---|---|
| Implementation | C++ bodies in winuxcmd.exe |
Rust library functions in the same image |
| Command set / names / options | 176 applets | unchanged (retired 1.x-only option spellings excepted) |
--help / --version text |
WinuxCmd-branded | unchanged (same dispatcher surface) |
| GNU behavior | measured, with tracked deviations | GNU byte-equal on the gated surface; every remaining deviation is classified |
sort speed |
reference | 12x faster plain sort on the 64 MiB NTFS benchmark |
| Streaming stdin | whole-buffer ABI | incremental pull callback (v2) |
| Translations | C++ catalog | per-invocation host injection + separate catalog repo |
| Editions / multicall / WPM | default + full | unchanged |
| Windows subsets | NTFS modes, ownership, symlinks, SELinux, FIFOs | unchanged, documented |
Retired 1.x extensions (GNU has no such option, or treats it as data):
echo -u/--upper, echo -r/--repeat, fold -c,
fmt -m/-P/-x/-X/-T, numfmt --unit-separator/-M/-l and the Z/Y/R/Q
suffixes as 1.x accepted them. Each has a GNU citation in the migration
guide §3.
Not yet changed: applets still on the 1.x core behave exactly as in
1.2.1. Their GNU gaps are tracked as compat-gap issues (#1639–#1657) and
will be fixed by their Rust rewrites, not by 2.0.0.
🧰 Command coverage
176 applets across GNU coreutils, findutils, grep/sed, util-linux, BSD tools, process management, Cygwin/MSYS bridging and WinuxCmd extensions. The command surface is unchanged from 1.x; what is changing is the engine behind each applet.
| Family | Examples |
|---|---|
| File operations | ls cp mv rm ln mkdir install stat du df |
| Text processing | cat head tail cut tr sort uniq fmt paste pr |
| Search & traversal | find xargs locate updatedb whereis which |
| Digests & encoding | md5sum sha*sum b2sum cksum base64 base32 basenc |
| Paths & links | readlink realpath basename dirname pathchk cygpath |
| Process & system | ps top kill timeout nice nohup free uptime |
| Permissions | chmod chown chgrp getfacl chcon runcon |
| Terminal & docs | tty stty tput clear reset man less more |
| WinuxCmd extensions | wpm regtool mkgroup mkpasswd d2u u2d |
Per-command support state (Rust-wired / deferred / retained face) and the
issue anchors live in
DOCS/2.0-inventory.tsv; the summary is
DOCS/2.0-inventory-summary.md.
🧪 Testing and GNU verification
2.0 gates each wired command three ways:
- GNU oracle — the wired product vs WSL GNU (coreutils 9.4, findutils
4.9.0, util-linux 2.39.3, Debian hostname 3.23), byte-for-byte on stdout
and exit status for
strictrows. - Existing tests — the full
ctestfailure set must equal the pre-wiring baseline. - Old vs new exe — an argument matrix compares rc/stdout/stderr; every divergence must be explained as a 1.x deviation the replacement corrects.
Case tables are generated (rust2/gate/gen-cases.py); every row is
strict/exit/win/note, and a note row without a registry entry is
itself a finding. The measured narrative is
rust2/GATE-REPORT.md; the wave5 full run
(2026-11-13) covered 82 commands / 2,444 cases, and xargs adds 141. The
release run replaces those numbers.
Windows-value-model rows (id, uname, hostname, getconf, df,
whoami, nproc) gate rc against GNU and stdout against the 1.x value
model; they are recorded, not skipped.
📚 Documentation
| Document | Description |
|---|---|
| Migration guide 1.x → 2.0 | Per-command differences, retired extensions, platform subsets |
| Release notes 2.0.0 | Bilingual release notes (draft until the tag) |
| Command inventory | 176 applets, three states, exemption anchors |
| Inventory summary | Method, counts, terminal state |
| Regex engine decision | Why winux-regex is a port, and the grep -P exemption |
| Replacement recipe | How one applet is wired (three gates, split engine, streaming, I18N) |
| Gate report | Per-wave differential results |
| Compatibility matrix | 1.x-era per-command support notes |
| WPM guide | Package manager user guide |
| Windows features | Windows-specific behavior |
📦 Editions
WinuxCmd ships in two editions built from the same source:
| Default edition | Full edition | |
|---|---|---|
| Assets | WinuxCmd-<version>-win-<arch>.* |
WinuxCmd-<version>-win-<arch>-full.* |
| Entry links | All commands except the full-only names | All entries |
| wpm index | yes | not indexed — standalone download only |
Full-only commands: the default edition does not create entry links for
[ · env · false · kill · test · time ·
true. Their user-facing semantics are defined by your host shell's
builtins, so a kill.exe-style entry on PATH advertises a dispatch the
builtin owns. The commands stay fully implemented in the multicall binary —
winuxcmd kill -9 <pid> works in both editions. echo, printf and pwd
keep their entries. The definition lives in one place
(src/core/dispatcher.cppm
is_full_only_command).
📦 WPM package manager
wpm install jq # JSON processor
wpm install goawk # awk implementation
wpm install bsdtar # BSD tar
wpm install openssh # SSH client
wpm install make # GNU make
wpm install neovim # text editor
wpm search json # discover packages
wpm list --all # see what's installed
Details in the WPM User Guide.
🐂 Better together: the niubash shell
WinuxCmd gives Windows real Unix commands. niubash gives them a real bash language to live in:
for f in *.log; do
grep -c ERROR "$f" | xargs -I{} echo "$f: {} errors"
done | sort -t: -k2 -rn | head -5
niubash injects WinuxCmd's command links onto PATH at startup, so the
grep, sed and find above are the real binaries.
🛠️ Building from source
Prerequisites: Visual Studio 2022+ · CMake 3.30+ · Ninja · Rust (stable) with both MSVC targets.
# Build (always use the script; it sets up the VS environment)
./scripts/build-with-vs.ps1
# Build the full edition (all entry links, "-full" asset names)
cmake -B build-full -G Ninja -DCMAKE_BUILD_TYPE=Release -DWINUXCMD_PACKAGE_EDITION=full
# Tests
./scripts/build-with-vs.ps1 -Target winuxcmd-tests
build-vs/tests/winuxcmd-tests.exe
Rust toolchain (rust2 command library, #1488)
Install rustup (stable) plus both MSVC targets:
rustup target add x86_64-pc-windows-msvc aarch64-pc-windows-msvc. Theaarch64target is required even on an x64 host when you cross-build arm64: cargo builds the staticlib with--targetfor the C++ target architecture. CI pins the toolchain (RUST2_TOOLCHAINin.github/workflows/build-winuxcmd.yml).WINUXCMD_ENABLE_RUST2defaults ON when cargo is found and OFF when it is not;-DWINUXCMD_ENABLE_RUST2=ONwithout cargo is a configure-time error.No C++ fallback exists. A Rust-less build omits every command in
WINUXCMD_RUST2_COMMANDS(currently 50) from that build; the command is never dual-tracked (#1550). Official builds ship Rust.Cross-arch consistency: CI's
rust2-surface-checkrequires x64 and arm64 packages to carry the same rust2 surface.Run the Rust tests:
cd rust2 cargo test -p winux-core -p winux-regex -p winux-cmds
Profile-Guided Optimization (x64): release CI builds the published x64 binary with PGO. To reproduce locally:
./scripts/build-pgo.ps1 # -> build-pgo/usr/bin/winuxcmd.exe
Training workloads are in scripts/pgo-train.sh; ARM64 builds are not
PGO'd (profiles must be collected on the target architecture).
📏 Code size
Counted with tokei over the whole tree (tests included), refreshed weekly by the readme-stats workflow:
| Language | Files | Code lines |
|---|---|---|
| C++ | 374 | 122,033 |
| Rust | 152 | 102,415 |
| JSON | 46 | 40,951 |
| C++ Header | 1 | 17,952 |
| Python | 39 | 16,996 |
| Shell | 24 | 5,149 |
| PowerShell | 46 | 4,645 |
| C Header | 16 | 2,978 |
| CMake | 8 | 1,003 |
| C# | 1 | 325 |
| Other | 13 | 293 |
| Total | 720 | 314,740 |
👥 Maintainers and contributors
WinuxCmd is maintained by its two core maintainers:
| Maintainer | Role |
|---|---|
| @caomengxuan666 | Creator and core maintainer |
| @arookieofc | Core maintainer |
Thanks to everyone who has contributed code, bug reports, and fixes (emoji key):
caomengxuan666 💻 🚧 |
arookieofc 💻 🚧 |
Uarz 💻 |
Catapult291 💻 |
daiaji 💻 |
arookieofc-ai 💻 |
OpenCode 💻 |
zzmyth-sys 💻 |
Haoming9527 💻 |
dingyi580 💻 |
ShiomiHC 🐛 |
qwased 🐛 |
Everyone who has landed code (bots excluded), refreshed weekly by the readme-stats workflow:
| Contributor | Commits |
|---|---|
| @caomengxuan666 | 2,062 |
| @arookieofc | 83 |
| @Uarz | 14 |
| @Catapult291 | 4 |
| @daiaji | 4 |
| @arookieofc-ai | 3 |
| @OpenCode | 2 |
| @zzmyth-sys | 2 |
| @Haoming9527 | 1 |
🤝 Contributing
Contributions welcome — see CONTRIBUTING.md. For the Rust
core, read rust2/REPLACEMENT-RECIPE.md
first: a replacement is mechanical, deletes the old body in the same change,
and passes the three gates.
License
MIT — see LICENSE. PCRE2 is a pinned static dependency (pcre2-10.47) and ships its license with the source tree.
WinuxCmd — because ls shouldn't require a Linux kernel.
Pair it with niubash — the native bash shell that speaks GNU fluently on Windows.
Explore projetos relacionados
Carregando…