coreutils README

The project's README from github.com/microsoft/coreutils. As one markdown file: README.md.

Coreutils for Windows

UNIX-style core utilities for Windows. The same commands and pipelines you use on Linux, macOS, and WSL - natively.

Install · Shell conflicts · Windows caveats · Contributing


A Microsoft-maintained build of uutils/coreutils, findutils, and grep packaged as a single multi-call binary for Windows. The goal is to make moving between Linux, macOS, WSL, containers, and Windows frictionless: the same commands, flags, and pipelines work the same way, so existing scripts carry over without translation.

Each command supports the standard --help flag for full syntax and options.

This project is in preview.


Install

Install Coreutils for Windows with WinGet:

winget install Microsoft.Coreutils

Or grab the latest build from our Release Page.


Creating custom alias

[!WARNING] Using PowerShell aliases will cause binary stream compatibility. Some utilities will not work when piped (e.g. xargs, find, ...)

Shell conflicts

[!NOTE] Any command not mentioned is included in this suite. The following only lists conflicts.

[!NOTE] You can remove additional utilities using coreutils-manager disable <utility name>. See coreutils-manager --help for other management commands.

[!WARNING] PowerShell 7.4 or later is required. PowerShell 7.6 or later is recommended for ~ support.

Several commands share names with built-ins in CMD and PowerShell. Whether the Coreutils version runs depends on the shell, the PATH order, and (for PowerShell) the alias table.

Legend: ✅ ships and works · ⚠️ ships but conflicts with a built-in · 🛑 not shipped

Command CMD PowerShell 7.4+ Notes
cat ✅ ⚠️
cp ✅ ⚠️
date ⚠️ ⚠️
dir 🛑 🛑 Conflicts with the built-in DOS command
echo ⚠️ ⚠️
expand 🛑 🛑 Conflicts with the built-in DOS command
find ✅ ✅ Integrated port of the original DOS command
hostname ✅ ✅ Superset of the Windows built-in
kill 🛑 🛑 Unavailable due to lack of signals on Windows; Implementing a form of SIGTERM/SIGKILL may be possible in the future however
ls ✅ ⚠️
mkdir ⚠️ ⚠️
more 🛑 🛑 Conflicts with the built-in DOS command (consider edit as an alternative)
mv ✅ ⚠️
pwd ✅ ⚠️
rm ✅ ⚠️
rmdir ⚠️ ⚠️
sleep ✅ ⚠️
sort ✅ ⚠️ Integrated port of the original DOS command
tee ✅ ⚠️
timeout 🛑 🛑 Relies on kill's functionality
uptime ✅ ⚠️
whoami 🛑 🛑 Conflicts with the built-in Windows command

Windows caveats

Difference Detail
CRLF line endings Windows text files often use CRLF (\r\n). Most utilities handle this transparently, but byte-oriented behavior can still observe the \r; for example, uniq may treat the final line as different from a preceding duplicate if the input uses CRLF and the final line has no trailing newline.
No /dev/null Use NUL instead, for example find . -name "*.log" > NUL
No POSIX signals Signals such as SIGHUP, SIGPIPE, and SIGUSR aren't available. Ctrl+C (SIGINT) works as expected.
Path separators Both / and \ are accepted. Some utilities produce \-separated output, which can affect downstream piping.
File permissions Windows uses ACLs, not POSIX permission bits. Permission-based predicates (for example find -perm) may behave differently or be unavailable.
Symbolic links Reading existing symbolic links works without elevation. Creating new symbolic links requires Developer Mode (Settings > System > Advanced) or an elevated terminal.

PowerShell Command Parsing

The installer integrates itself with interactive PowerShell sessions via PSReadLine. It ensures that quoted expressions behave somewhat like they do under UNIX shells or CMD: echo *.txt will then print a number of file names, while echo '*.txt' will print "*.txt" literally.

There are two shortcomings, however:

Intentionally dropped

Commands that exist upstream but aren't shipped here because they rely on POSIX-only concepts, would break existing Windows scripts, or simply aren't useful on Windows.


Contributing

Bug reports and pull requests are welcome. See CONTRIBUTING.md for details on the repo layout and how changes flow between this repo and the upstream uutils projects.

coreutils (microsoft/coreutils)

Searching Database…

这是什么东西?这是由 Microsoft 维护的 uutils/coreutils、findutils 和 grep 的构建版本——把大家熟悉的 Unix 命令(ls、cp、cat、grep、find)打包成一个 Windows 原生的多合一(multi-call)二进制文件。
它是运行在 WSL 里,还是 Windows 原生的?完全是 Windows 原生工具——不需要 WSL、虚拟机或任何 Linux 层。目标是让同样的命令、参数和管道在 Linux、macOS、WSL、容器和 Windows 上表现完全一致。
我需要特定版本的 PowerShell 才能正常使用吗?需要 PowerShell 7.4 或更高版本,如果要支持 ~(波浪号)则建议 7.6 及以上。这套工具本身只是一个独立的 Rust 二进制文件,不需要另外安装别的东西。
我熟悉的那些 Unix 命令这里都有吗?大部分都有,但有些是有意不提供的:由于 Windows 没有 POSIX 信号,kill 和 timeout 不可用;而 chmod、chown、chroot、dd 和 uname 这类仅适用于 POSIX 的工具,因为在 Windows 上没用或者会破坏脚本,也被去掉了。
命令名会不会和 CMD 或 PowerShell 自带的命令冲突?会。好几个命令和内置命令重名(echo、mkdir、sort、ls 等),最终执行哪一个取决于所用的 shell、PATH 的顺序以及 PowerShell 的别名表。像 dir、more 和 whoami 这种硬冲突的命令完全没有提供。
在 Windows 上有哪些坑需要注意?文本文件使用 CRLF 换行符,像 uniq 这种按字节处理的工具可能会因此出错;没有 /dev/null(请改用 NUL);虽然没有 POSIX 信号,但 Ctrl+C 仍然有效;另外,创建新的符号链接需要开启开发者模式或使用管理员权限的终端。
我能给 ls -la 设置一个 ll 别名吗?可以:在 PowerShell 里用 Set-Alias ll 'ls',如果需要带参数,就在 $PROFILE 里定义一个函数;在 CMD 里用 doskey。注意 PowerShell 的别名不支持二进制流,所以像 xargs 和 find 这类通过管道配合使用的工具可能无法正常工作。
它适合日常使用,还是仍处于实验阶段?项目明确处于预览(preview)阶段,所以难免有粗糙的地方——但它由 Microsoft 在上游 uutils 项目的基础上维护,而且每个命令都支持标准的 --help 参数。
Creator
microsoft
Size
0.1 MB
Stars
5.3K
Age
5mo
Commits · 90 Days