Windows 版 Coreutils
Coreutils for Windows

原始链接: https://github.com/microsoft/coreutils

微软已发布 **Coreutils for Windows** 预览版,这是一个原生、多调用(multi-call)的二进制文件,包含了基础的 UNIX 风格实用程序(uutils/coreutils、findutils 以及兼容 GNU 的 grep)。该项目旨在消除开发者在 Linux、macOS、WSL 和 Windows 之间切换时的障碍,确保脚本、命令和管道在不同环境中能够一致运行。 关键点: * **安装方式**:可通过 `winget install Microsoft.Coreutils` 或项目发布页面进行安装。 * **兼容性**:需要 PowerShell 7.4 或更高版本。请注意,部分命令会与 Windows 原有的 CMD 或 PowerShell 内置命令冲突,需妥善管理 `PATH` 或 shell 别名。 * **运行差异**:用户应注意 Windows 特有的行为,包括 CRLF 换行符、使用 `NUL` 代替 `/dev/null`、缺失 POSIX 信号,以及使用 ACL 而非 POSIX 文件权限。 * **范围**:部分仅限 POSIX 的命令(如 `chmod` 或 `chown`)已被省略,被认为与 Windows 环境无关的工具亦未包含在内。 作为一个开源项目,该项目欢迎贡献代码和报告错误,以期在 UNIX 工具生态与 Windows 生态之间架起桥梁。

相关文章

原文

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


A Microsoft-maintained build of uutils/coreutils, findutils, and a GNU-compatible 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 Coreutils for Windows with WinGet:

winget install Microsoft.Coreutils

Or grab the latest build from our Release Page.

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.

⚠️ PowerShell 7.4 or newer is required. Older PowerShell versions aren't supported.

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 ⚠️
paste 🛑 🛑 Conflicts with the built-in DOS command
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

Difference Detail
CRLF line endings Windows text files often use CRLF (\r\n). Most utilities handle this transparently, but pattern matching with $ and exact byte counts can be affected.
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.

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.

  • dd: Perhaps useful in the future.
  • dircolors, shred, sync, uname: Not particularly useful on Windows.
  • chcon, chgrp, chmod, chown, chroot, groups, hostid, id, install, logname, mkfifo, mknod, nice, nohup, pathchk, pinky, runcon, stdbuf, stty, tty, users, who: POSIX-only concepts unavailable on Windows.

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.

联系我们 contact @ memedata.com