Windows coreutils from Microsoft
The ubiquitous GNU coreutils has long been missing from Windows.
We found ourselves invoking coreutils utilities via WSL using wsl <coreutils command> to get access to these utilities on Windows until now.
Microsoft has enhanced Rust-based uutils coreutils to run natively on Windows, and has made it available via WinGet:
winget install --id=Microsoft.Coreutils -eClose / reopen the Terminal windows to use Coreutils, which has distinct conflict and availability of tools when using ComSpec Command Prompt vs PowerShell. Some commands are so POSIX-intrinsic that they are not available or relevant in Microsoft coreutils. Other coreutils commands overlap so much or conflict with Windows intrinsic commands that they are omitted from Microsoft coreutils. There are distinctions in command parsing of Microsoft coreutils vs. standard coreutils to be aware of.
A general issue across systems that use “coreutils”, say on embedded or other minimal systems where not all coreutils are available, is that it’s up to the developer to handle cases where some coreutils tools isn’t available or overloaded by something else. Build systems like CMake also handle these problems, like what exactly is “gcc” when multiple compilers masquerade as “gcc” – CMake inspects the version string to formally ID the compiler vendor. To use a script consuming coreutils on Windows, the script needs to handle issues like the following, where MSVC “link” is overriding coreutils “link”:
where.exe linkC:\Program Files\Microsoft Visual Studio\18\Community\VC\Tools\MSVC\*\bin\HostARM64\arm64\link.exe
C:\Program Files\coreutils\bin\link.exe
Have a look in Cargo.toml to see the Microsoft coreutils commands.
We have long augmented CMake projects with Bash and PowerShell scripts to handle tasks too awkward for CMake. Python usually has enough built-in capability in “os”, “pathlib”, and “shutil” to avoid needing coreutils in Python scripts.
GNU / Windows ?
Could Windows with Microsoft coreutils be considered a GNU / Windows hybrid - no, because Microsoft coreutils is based on uutils coreutils, which is an MIT-licensed reimplementation of GNU coreutils in Rust. GNU / Linux is a common term for Linux distributions that include GNU utilities, and Microsoft coreutils brings many of those utilities to Windows. While it’s not a full GNU environment, it does provide a significant portion of the GNU toolset on Windows, making it a sort of hybrid in terms of command-line utilities.
As background, the core components of a typical GNU/Linux system include:
- Linux Kernel: Core of the system, handling hardware and process management
- GNU Utilities: Essential tools for file management, text processing, and system administration
- Display Server and Desktop Environment: X11 or Wayland for graphics, with desktop environments like GNOME, KDE Plasma, or Xfce
- Package Manager: Software installation and updates (e.g., APT, DNF, Pacman).
- Shell: Command-line interface for interacting with the system.
On Windows the core components include:
- Windows Kernel: Core of the system, handling hardware and process management
- Microsoft coreutils: Essential tools for file management, text processing
- Display Server and Desktop Environment: Windows GUI for graphics and user interface
- Package Manager: WinGet for software installation and updates
- PowerShell: Command-line interface for interacting with the system
On macOS the core components include:
- XNU Kernel: Core of the system, handling hardware and process management
- BSD Utilities: Essential tools for file management, text processing, and system administration
- Display Server and Desktop Environment: Quartz for graphics, with the macOS desktop environment
- Package Manager: Homebrew for software installation and updates
- Shell: Terminal with Zsh for command-line interface