WinuxCmd
Use this skill when working inside the WinuxCmd repository or when preparing a WinuxCmd release bundle.
Start Here
- If you are already in the repo, activate the workspace-local command directory for the current shell:
.\scripts\activate-workspace.ps1
- If you are in
cmd, use:
scripts\activate-workspace.cmd
- If you are starting from a downloaded WinuxCmd release, register the release binary in the workspace first:
.\scripts\setup-workspace-bin.ps1 -WinuxCmdPath "C:\path\to\winuxcmd.exe"
.\scripts\activate-workspace.ps1
- When you need command help on Windows, call
man.exe, notman.
Why man.exe
- PowerShell resolves aliases before native executables.
manis often an alias for PowerShell help, soman.exeis the unambiguous WinuxCmd command.- Use explicit
.exenames whenever an alias could collide with a WinuxCmd tool.
Workspace Activation
.winuxcmd/binis the repo-local command directory.scripts/setup-workspace-bin.ps1creates the command links there.scripts/activate-workspace.ps1prepends.winuxcmd/binto the current PowerShell session only and clears common alias collisions for that session.scripts/activate-workspace.cmddoes the same for CMD sessions.scripts/install-workspace-profile-hook.ps1adds a per-user PowerShell 7 / Windows PowerShell 5.1 hook so new shells auto-activate in this repository.- If you are already inside an extracted release directory,
scripts/create_links.ps1can generate the release-side command links there.
Typical commands after activation:
man.exe ls
grep.exe -n TODO README.md
winuxcmd.exe help sort
Rules
- Do not modify user PATH or machine PATH.
- Do not rely on PowerShell aliases such as
manorls. - Use the repository-local
.winuxcmd\bindirectory for command execution. - If a command exists both as a PowerShell alias and as a WinuxCmd executable,
always call the executable with
.exe.
Build and Test
- Use
scripts/build-with-vs.ps1when you need an MSVC build/test run. - Default target:
winuxcmd-tests. - Default build directory:
build-vs. - Default environment script:
vcvars64.bat.
Command Guidance
- After activation, bare
ls,cp,mv,rm, and similar common commands should resolve to WinuxCmd in the current session. - Use the repo's GNU-parity flags when they reduce AI mistakes:
ls:-d,-b,-f,-I,-U,-X,-v,-i,-s,-h/--human-readable,--block-size=SIZE,-Q,-b,-q,-N,--quoting-style=WORD; directory long listings includetotal, hard-link counts come from Windows file metadata,-hhumanizes long sizes and-s/total, sort/time/quoting-affecting options use last-occurrence precedence, and wildcard matches that are directories list contents unless-dis activecp:-a/--archive,-p,-t,-T,-n,-u,-b/--backup,-S/--suffix;-trequires an existing directory,-tand-Tconflict, self-copy is refused except--force --backup, and plain file copies do not create missing parentsmv:-t,-T,-n,-u,-b;-trequires an existing directory,-tand-Tconflict, and ordinary multi-source moves require an existing target directory after wildcard expansionrm:-f,-d/--dir,-r/-R/--recursive,-I,-i,--interactive[=never|once|always],--one-file-system;rm -fwith no operands succeeds,-dremoves only empty directories, and-f/-i/-I/--interactive=WHENuse last-option precedence for prompting/force behaviorinstall:-D,-d,-t,-T;-tand-Tconflict, multi-source installs require an existing target directory after wildcard expansion,-D -tcreates the target directory, and-dcreates parent directoriessort: repeatable-k/--keywithF[.C][OPTS][,F[.C][OPTS]],--sort=WORD,-M,-R,--random-source,-S/--buffer-size,-s,-t \0,-u,-V;-t \0uses NUL as the field separator, global ordering modes use last-occurrence precedence,-ndoes not accept leading+or exponent notation,-hcompares sign then SI suffix then value,-uuses sort-key equality and disables last-resort whole-line ordering,-c/-C -urejects adjacent equal keys,-baffects-k F.Ccharacter counts, and end position.0means field endgrep:-E,-F,-G, repeatable-e/--regexp, repeatable-f/--file,-i,-v,-n,-c,-l,-L,-H/-h,--label,--line-buffered, repeatable--include/--exclude/--exclude-from/--exclude-dir,-A/-B/-Ccontext output,-o,-D/--devices,--color[=WHEN]; bare--colordefaults toauto, invalid color modes fail, zero-byte-fpattern files match nothing, include/exclude file rules keep command-line order and the last matching rule wins, command-line file operands match include/exclude globs by name suffix,--exclude-dirskips matching command-line directories and ignores trailing slashes, context ranges merge, match prefixes use:, context prefixes use-,-owarns while ignoring context options, and wildcard operands that expand to directories recurse when-r/-Ris activesed: ordered repeatable-e/--expressionand-f/--file,-i[SUFFIX]/--in-place[=SUFFIX],-n/--quiet/--silent,-E,-r,-s,-z/--null-data/--zero-terminated,-u/--unbuffered,-b/--binary; in-place editing creates no backup when suffix is omitted, appends suffix when it has no*, and replaces each*with the current filename otherwise;s///supports&,\1-\9, numeric occurrence flags,g,p, andI/i; address negation with!,first~step,0~step, and/regex/Iare supportedhead:-c,-n,-q,-v,-z; GNU count suffixes are accepted (KB/MB/.../QBdecimal,K/M/.../Qbinary, andKiB/.../QiBIEC) with overflow rejected; first-argument obsolete-[num][bkm][cqv]is accepted for compatibility, but prefer-c NUMor-n NUMtail:-c,-n,-q,-v,-z,-f,-F,-s,--max-unchanged-stats, repeatable--pid,--debug,--retry; GNU count suffixes are accepted (KB/MB/.../QBdecimal,K/M/.../Qbinary, andKiB/.../QiBIEC) with overflow rejected; obsolete-[num][bcl][f]is accepted when it does not conflict with normal parsing, but prefer-c NUM,-n NUM, and-ffind:-L,-H,-name,-iname,-path,-ipath,-regex,-iregex,-type,-size,-empty,-mtime,-mmin,-newer,-mindepth,-maxdepth,-depth,-true,-false,!,-not, implicit AND,-a/-and,-o/-or, comma expressions, parentheses,-print,-print0,-printf(%p,%f,%h,%d,%y,%s,%m,%T@,%%),-delete,-prune,-quit,-exec ... {} ;,-exec ... {} +,-ok ... {} ;,-ok ... {} +; predicate operators and these common actions follow GNU expression precedence and short-circuit behavior;-Hfollows only command-line symlink roots unless-Lis active; remaining gaps are full-printf, full GNU regex dialect details, and-deleteplus-pruneinteraction edge casescut:-b/--bytes,-c/--characters,-f/--fields,--complement,--output-delimiter,-zdf:-h,-H,-k,-T/--print-type,-i/--inodesdu:-a,-A/--apparent-size,-B/--block-size,-b/--bytes,-c/--total,-d/--max-depth,-h,--si,-H/--dereference-args,-k,-m,-0/--null,-S/--separate-dirs,-s,-t/--threshold,--time[=WORD],--exclude=PATTERN,-X/--exclude-from,--files0-from; default output uses 1024-byte blocks, later size-display options override earlier ones,--block-size=human-readable|siis accepted,--max-depth=0prints only the root total,--time=atime|access|use|ctime|status|mtimeuses last-occurrence precedence,ctime/statuscurrently map to creation time on Windows,--excludepatterns stay literal option patterns, Windows size reporting uses file length as the allocated/apparent-size approximation, and-His not SI outputenv:-i/--ignore-environment, repeatable-u/--unset=NAME,-0/--null,-C/--chdir=DIR,NAME=VALUE COMMAND [ARG]...printenv:-0/--null; named empty variables still emit empty records, mixed found/missing names preserve found output while returning status1, and full enumeration skips Windows hidden=...pseudo-entriestty:-s/--silent,--quiet; extra operands keep GNU-style stderr diagnostics with exit2, non-tty stdin returns1, and broken stdout during non-silent output returns GNU/uutils-style exit3pwd:-L/--logical,-P/--physical; default output remains physical,-Lprefers an absolutePWDenvironment value when present, and the-L/-Pfamily uses last-occurrence precedencerealpath:-e,-E,-m,-q,-s,-z,--relative-to,--relative-base; at least one path operand is required, canonicalization-mode options use last-occurrence precedence, empty path / relative-option operands are rejected as invalid empty strings, and under-ethe relative-option operands must resolve to directoriesreadlink:-f,-e,-m,-n,-q,-s,-v,-z; canonical modes normalize Windows paths, default diagnostics stay quiet, and the-q/-s/-vfamily uses last-occurrence precedencexargs:-n/--max-args,-L/--max-lines,-l,-I,-i/--replace,-P/--max-procs,-p/--interactive,-0/--null,-d/--delimiter,-a/--arg-file,-E,-e/--eof,--show-limits,-t/--verbose,-o/--open-tty,-r/--no-run-if-empty,-s/--max-chars,-x/--exit,--process-slot-var;-pprompts before each command and runs only fory/Y, default echo output has no trailing space; mutually exclusive-I/-i,-L/-l, and-nfamilies use the last conflicting family and warn, except-I ... -n1; child failures map GNU-style for common cases (1..125 -> 123,255 -> 124, not found ->127)dd:if=,of=,bs=,ibs=,obs=,count=,skip=,seek=,conv=sync,conv=notrunc,status=none|noxfer|progress
- Treat wildcard characters as syntax unless the operand is a file input:
greppatterns,sedscripts,jqfilters,xargsinput items, and destination operands such astee OUTorinstall SRC DESTstay literal. File input operands such asgrep PATTERN *.txtandsed SCRIPT *.txtexpand inside WinuxCmd. - For fixed-arity file commands such as
diff,diff3,split, andcsplit, let wildcard expansion resolve to the exact number of operands the command expects; do not guess a first match. - Keep the implementation matrix and GNU parity ledger synchronized with code changes in the same batch.
- If a command is already available as a WinuxCmd executable, prefer it over a PowerShell alias or external fallback.
Release Packaging
- When packaging the skill, load
references/release-packaging.mdfirst. - Confirm the bundle layout, then package the standalone bundle with the Windows binaries.
- Keep the skill bundle rooted at
winuxcmd/withSKILL.mdat the top level of the archive. - Keep the skill bundle small and release-ready; long-form details belong in
references/.
References
references/workspace-integration.mdreferences/download-and-integrate.mdreferences/command-guidance.mdreferences/release-packaging.md
Source: caomengxuan666/WinuxCmd — distributed by TomeVault.