Microsoft Coreutils: Run Native UNIX Commands Like ls, cat, cp on Windows
Microsoft officially maintains a Windows port of GNU Coreutils, enabling seamless use of classic UNIX commands such as ls, cat, cp, and rm across Linux, macOS, WSL, and PowerShell, with detailed compatibility tables, installation methods, and platform‑specific considerations for developers and DevOps engineers.
Overview
Microsoft Coreutils is an officially maintained collection of UNIX‑style core utilities for Windows. It provides Rust‑based implementations of common commands such as ls, cat, cp, rm, etc., enabling scripts written for Linux, macOS, or WSL to run unchanged on Windows.
Upstream components
uutils/coreutils – Rust rewrite of GNU coreutils
uutils/findutils – Unix find implementation
uutils/grep – new grep implementation
Installation
Three supported methods:
WinGet (recommended): winget install Microsoft.Coreutils Download the latest release binary from the GitHub releases page.
Build from source:
git clone https://github.com/microsoft/coreutils.git
cd coreutils
cargo build --releaseVerification
# Show version
ls --version
# Command help
cat --help
# List available commands (run the binary without arguments)PowerShell integration
The installer registers the binaries with PSReadLine so that quoted arguments behave like in a POSIX shell.
# Wildcard expansion
echo *.txt
# Literal string
echo '*.txt'PowerShell escape character remains the back‑tick ( `); Bash‑style backslash escapes are not valid.
# Bash‑style (invalid)
find . \( -foo -bar \)
# PowerShell syntax
find . `( -foo -bar `)Because of PSNativeCommandPreserveBytePipe, Get-Command may show these utilities as built‑ins and Get-Help may not return the correct help text. Use cmd /c help or the utility’s own --help flag instead.
Compatibility notes
Symbols used in the compatibility list:
✅ – Included and works normally ⚠️ – Included but conflicts with a built‑in command (PATH order matters) 🛑 – Not included
Command CMD PowerShell Notes
--------------------------------
cat ✅ ⚠️ PATH priority issue
cp ✅ ⚠️ Alias to Copy-Item
date ⚠️ ⚠️ Conflicts with built‑in command
ls ✅ ⚠️ Alias to Get-ChildItem
find ✅ ✅ Rust version of DOS find
...Windows‑specific differences
Line endings
Windows uses CRLF ( \r\n) while Linux uses LF ( \n). Pattern matching and byte counting can be affected.
# Pattern matching may fail
grep "pattern$" file.txt
# Byte count differs because of CRLF
wc -c file.txtConvert files with dos2unix or an editor before processing.
No /dev/null
Use NUL as the null device.
# Linux/macOS
find . -name "*.log" > /dev/null
# Windows with Coreutils
find . -name "*.log" > NULMissing POSIX signals
Signals such as SIGHUP, SIGPIPE, SIGUSR1, SIGUSR2 are unavailable. Supported signals include:
✅ SIGINT (Ctrl+C)
✅ SIGTERM (future support)
✅ SIGKILL (future support)
Commands that rely on unavailable signals ( kill, nohup, timeout) are not provided.
Path separators
Both / and \ are accepted, but some utilities output backslashes. Using forward slashes yields more consistent results.
# Possible mixed output
ls # output: file.txt
ls | sort # output may contain \ separators
# Recommended usage
find . -name "*.txt"
find . -name "*.txt" | xargs cat > output.txtFile‑permission model
Windows uses ACLs instead of POSIX permission bits. Options that depend on -perm may not work; use generic filters.
# Not recommended
find . -perm 644
# Recommended
find . -type f -name "*.txt"Symbolic‑link creation
✅ Reading existing symlinks requires no elevated rights.
⚠️ Creating new symlinks requires Developer Mode or an elevated terminal.
Commands not provided
Utilities that depend on POSIX concepts, conflict with existing Windows commands, or are impractical on Windows are omitted, e.g., dd (future), dircolors, shred, sync, uname, and permission‑management tools such as chmod, chown, etc.
Supported scenarios
Cross‑platform development where scripts run on Linux, macOS, WSL, and Windows.
DevOps pipelines that need a single command set for CI/CD agents on multiple OSes.
Migration of Linux shell scripts to Windows environments.
Learning UNIX commands on a Windows workstation.
Reference
- GitHub repository: https://github.com/microsoft/coreutilsSigned-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
AI Open-Source Efficiency Guide
With years of experience in cloud computing and DevOps, we daily recommend top open-source projects, use tools to boost coding efficiency, and apply AI to transform your programming workflow.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
