coreutils 安装指南:uutils-coreutils 三条路线,最快 30 秒跑起来
【免费下载链接】coreutilsCross-platform Rust rewrite of the GNU coreutils项目地址: https://gitcode.com/GitHub_Trending/co/coreutils
coreutils(uutils-coreutils) 是用 Rust 重写的 GNU 核心工具集,跨平台支持 Linux、macOS 和 Windows。它解决的正是"各系统命令行为不一致"的老问题:同一份ls、cp、grep、wc实现,在三类系统上表现完全一致。装完后你会得到一个coreutils可执行文件,支持coreutils ls -l这种子命令调用,各工具也能独立调用。它是跨平台命令行工具,不是系统工具的替代品——默认装完只是多了一个选择。
先看这张表,10 秒定路线
| 路线 | 适合谁 | 代价 |
|---|---|---|
| 包管理器直装 | 系统仓库里已有包,想最快用上 | 版本由发行版决定,可能落后上游 |
| Cargo / Conda | 想要最新版,或多台机器保持同一版本 | Cargo 首次编译几分钟;Conda 绑定 conda 环境 |
| 源码编译 | 需要未发布的新特性或自定义构建 | 要装 Rust 工具链,耗时最长 |
一行命令装好 📦
你的系统包管理器里已经有它,就直接走这条,是最快的路。各平台的命令都在这张表里:
| 平台 / 管理器 | 命令 |
|---|---|
| Arch / Manjaro(pacman) | pacman -S uutils-coreutils |
| Debian / Ubuntu(apt) | apt install rust-coreutils |
| Fedora(dnf) | dnf install uutils-coreutils |
| macOS(Homebrew) | brew install uutils-coreutils |
| macOS(MacPorts) | port install coreutils-uutils |
| Windows(Winget) | winget install uutils.coreutils |
| Windows(Scoop) | scoop install uutils-coreutils |
注意 Debian 和 Fedora 装完后,可执行文件不在默认 PATH 里,补一句就能用(建议写进 shell 配置文件):
export PATH=/usr/lib/cargo/bin/coreutils:$PATH # Debian / Ubuntu export PATH=/usr/libexec/uutils-coreutils:$PATH # Fedora装完跑一下验证:
coreutils --version输出带版本号的行,就算成功。
没有包、要最新版:用 Cargo 或 Conda 🔧
这条路线给两类人:发行版仓库里还没有这个包,或者你想让几台机器装到完全相同的版本。前提是装了 Rust 工具链,Conda 路线则只需要 conda。
按平台选 feature 装(macOS 属于 Unix 系,用unix即可):
# Linux / macOS cargo install coreutils --features unix --locked # Windows cargo install coreutils --features windows --locked偏好 conda 环境(比如数据科学工作流)就一行:
conda install -c conda-forge uutils-coreutils首次编译要几分钟,期间 Cargo 会拉依赖并构建全部工具。结束后同样用coreutils --version验证,看到版本号即可。
发行版没包、包又不够新:从源码编译 🔨
只有三种情况值得走这条:你要用还没进任何仓库的新特性、要按自己的 feature 组合出定制构建、或者你就是这个项目的开发者。普通人跳过本节。
克隆仓库:
git clone https://gitcode.com/GitHub_Trending/co/coreutils && cd coreutils之后的编译安装细节不在这里展开,直接看官方 构建文档 和 DEVELOPMENT.md,里面有完整的 feature 组合(Cargo.toml 里能查到全部选项)。构建成功会产出coreutils可执行文件,放进 PATH 后coreutils --version有输出,同样算装好。
速查表 & 下一步
| 场景 | 命令 |
|---|---|
| Arch 系 | pacman -S uutils-coreutils |
| Debian / Ubuntu | apt install rust-coreutils |
| Fedora | dnf install uutils-coreutils |
| macOS | brew install uutils-coreutils |
| Windows | winget install uutils.coreutils |
| 任意平台、最新版 | cargo install coreutils --features unix --locked |
| conda 环境 | conda install -c conda-forge uutils-coreutils |
| 验证安装 | coreutils --version |
装好之后可以试两件事:跑coreutils --help看这台机器上可用的工具列表;挑一个天天用的命令(比如coreutils ls -l)对比一下原生版本的行为差异。想深入,安装文档 里还有 NixOS、Alpine、FreeBSD、MSYS2 等更多平台的现成命令。
【免费下载链接】coreutilsCross-platform Rust rewrite of the GNU coreutils项目地址: https://gitcode.com/GitHub_Trending/co/coreutils
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考