<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Coreutils &#8211; mylogs.cn</title>
	<atom:link href="https://mylogs.cn/tag/coreutils/feed/" rel="self" type="application/rss+xml" />
	<link>https://mylogs.cn</link>
	<description>发现、记录、分享</description>
	<lastBuildDate>Sun, 09 Aug 2026 02:46:03 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>为了几条命令开 WSL？现在真没必要了</title>
		<link>https://mylogs.cn/%e4%b8%ba%e4%ba%86%e5%87%a0%e6%9d%a1%e5%91%bd%e4%bb%a4%e5%bc%80-wsl%ef%bc%9f%e7%8e%b0%e5%9c%a8%e7%9c%9f%e6%b2%a1%e5%bf%85%e8%a6%81%e4%ba%86/</link>
					<comments>https://mylogs.cn/%e4%b8%ba%e4%ba%86%e5%87%a0%e6%9d%a1%e5%91%bd%e4%bb%a4%e5%bc%80-wsl%ef%bc%9f%e7%8e%b0%e5%9c%a8%e7%9c%9f%e6%b2%a1%e5%bf%85%e8%a6%81%e4%ba%86/#respond</comments>
		
		<dc:creator><![CDATA[steve, zhang]]></dc:creator>
		<pubDate>Sun, 09 Aug 2026 02:46:03 +0000</pubDate>
				<category><![CDATA[经验与技巧]]></category>
		<category><![CDATA[Coreutils]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[WSL]]></category>
		<category><![CDATA[命令行]]></category>
		<category><![CDATA[效率工具]]></category>
		<guid isPermaLink="false">https://mylogs.cn/%e4%b8%ba%e4%ba%86%e5%87%a0%e6%9d%a1%e5%91%bd%e4%bb%a4%e5%bc%80-wsl%ef%bc%9f%e7%8e%b0%e5%9c%a8%e7%9c%9f%e6%b2%a1%e5%bf%85%e8%a6%81%e4%ba%86/</guid>

					<description><![CDATA[在 Windows 上找一个几天前改过名的配置文件、从一堆日志里筛出报错行，习惯了 Linux 终端的人往往手 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">在 Windows 上找一个几天前改过名的配置文件、从一堆日志里筛出报错行，习惯了 Linux 终端的人往往手比脑子快——还没想清楚，WSL 的标签页已经开好了。问题是，为了这么几条命令挂着一整个 Linux 子系统，每次都要从一个环境跳到另一个环境再跳回来，思路就被打断了。</p>



<figure data-wp-context="{&quot;imageId&quot;:&quot;6a7829360b9fb&quot;}" data-wp-interactive="core/image" data-wp-key="6a7829360b9fb" class="wp-block-image size-large aligncenter wp-lightbox-container"><img fetchpriority="high" decoding="async" width="1200" height="675" data-wp-class--hide="state.isContentHidden" data-wp-class--show="state.isContentVisible" data-wp-init="callbacks.setButtonStyles" data-wp-on--click="actions.showLightbox" data-wp-on--load="callbacks.setButtonStyles" data-wp-on--pointerdown="actions.preloadImage" data-wp-on--pointerenter="actions.preloadImageWithDelay" data-wp-on--pointerleave="actions.cancelPreload" data-wp-on-window--resize="callbacks.setButtonStyles" src="https://mylogs.cn/wp-content/uploads/2026/08/3b0a34d89e572efab141dfb9dd8c0189_header.webp" alt="为了几条命令开 WSL？现在真没必要了" class="wp-image-4132" style="max-width:100%;height:auto;" srcset="https://mylogs.cn/wp-content/uploads/2026/08/3b0a34d89e572efab141dfb9dd8c0189_header.webp 1200w, https://mylogs.cn/wp-content/uploads/2026/08/3b0a34d89e572efab141dfb9dd8c0189_header-300x169.webp 300w, https://mylogs.cn/wp-content/uploads/2026/08/3b0a34d89e572efab141dfb9dd8c0189_header-1024x576.webp 1024w, https://mylogs.cn/wp-content/uploads/2026/08/3b0a34d89e572efab141dfb9dd8c0189_header-768x432.webp 768w" sizes="(max-width: 1200px) 100vw, 1200px" /><button
			class="lightbox-trigger"
			type="button"
			aria-haspopup="dialog"
			data-wp-bind--aria-label="state.thisImage.triggerButtonAriaLabel"
			data-wp-init="callbacks.initTriggerButton"
			data-wp-on--click="actions.showLightbox"
			data-wp-style--right="state.thisImage.buttonRight"
			data-wp-style--top="state.thisImage.buttonTop"
		>
			<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 12 12">
				<path fill="#fff" d="M2 0a2 2 0 0 0-2 2v2h1.5V2a.5.5 0 0 1 .5-.5h2V0H2Zm2 10.5H2a.5.5 0 0 1-.5-.5V8H0v2a2 2 0 0 0 2 2h2v-1.5ZM8 12v-1.5h2a.5.5 0 0 0 .5-.5V8H12v2a2 2 0 0 1-2 2H8Zm2-12a2 2 0 0 1 2 2v2h-1.5V2a.5.5 0 0 0-.5-.5H8V0h2Z" />
			</svg>
		</button><figcaption class="wp-element-caption">图片来源：MakeUseOf</figcaption></figure>





<p class="wp-block-paragraph">MakeUseOf 撰稿人 Afam Onyimadu 分享，他复盘之后发现自己真正离不开的只有八条命令：ls、grep、find、cat、sort、head、tail、wc。微软在 Build 2026 上推出的 Coreutils for Windows 正好补的就是这个缺口——它基于 Rust 编写的 uutils/coreutils 项目，把 coreutils、findutils（find、xargs）和一个 GNU 兼容的 grep 打包在一起，原生跑在 Windows 上。</p>



<h2 class="wp-block-heading">一、安装与验证</h2>



<ol class="wp-block-list"><li>打开管理员权限的终端，执行 <code>winget install Microsoft.Coreutils</code>，也可以从 GitHub 的 microsoft/coreutils 仓库下载安装包。</li><li>安装程序会把工具写入系统 PATH。磁盘上其实只落了一个 <code>C:\Program Files\coreutils\coreutils.exe</code>，再用 NTFS 硬链接生成 ls.exe、cat.exe 等一堆同名入口，程序靠自己被调用时的文件名决定执行哪个工具。</li><li>执行 <code>cat --version</code> 验证，正常应返回 uutils 的版本号。每条命令都支持 <code>--help</code> 查看完整参数。</li></ol>



<h2 class="wp-block-heading">二、先解决 PowerShell 的别名冲突</h2>



<p class="wp-block-paragraph">这是最容易踩的坑。PowerShell 自带 ls、cat、pwd 等内置别名，优先级高于 PATH，敲下去跑的仍是 Get-ChildItem、Get-Content。</p>



<ol class="wp-block-list"><li>诊断：执行 <code>Get-Command cat</code>，若 CommandType 显示 Alias，就是命中了别名。</li><li>临时解除当前会话的别名：<code>Remove-Item alias:cat -Force</code>；想长期生效，把这行写进 <code>$PROFILE</code>，每个冲突命令各写一行。</li><li>也可以直接带后缀调用，比如 <code>ls.exe</code>。</li><li>最省事的办法是改用命令提示符（CMD），CMD 下不存在这类别名冲突。微软文档里有一张兼容对照表，标出了 PowerShell 7.4 及以上版本中「已安装但会冲突」的工具。</li></ol>



<h2 class="wp-block-heading">三、可以直接照搬的用法</h2>



<p class="wp-block-paragraph"><code>ls -la</code> 和递归 <code>find</code> 都能原生跑通，<code>grep -r</code> 在整个项目目录里搜索也正常。该撰稿人常用的日志排查管线 <code>cat access.log | grep 500 | sort | uniq | wc -l</code> 可以原样执行；批量重命名文件、裁剪日志输出的几个 bash 单行脚本，几乎不用改就跑起来了——同样的逻辑若改写成 PowerShell，得换一套语法和对象管线思路。此外，在大型项目目录上做递归 grep 和 find，因为少了一层文件系统转换，速度比在 WSL 里更快。</p>



<h2 class="wp-block-heading">四、这些命令没有</h2>



<p class="wp-block-paragraph">chmod、chown、chroot、tty、who、id 依赖 Windows 不具备的 POSIX 权限模型，kill 和 timeout 则因为 Windows 没有 POSIX 信号，一并缺席。dir、more、expand、whoami 是微软刻意没收录的，避免覆盖 Windows 自带版本。另外要留意：<code>/dev/null</code> 在 Windows 这边写作 <code>NUL</code>；CRLF 行尾会影响 wc 的字节统计和正则里的 <code>$</code> 锚点匹配，脚本对输出精度敏感的话，上线前先测一遍。</p>



<p class="wp-block-paragraph">微软目前仍把它标为预览版。真正涉及包管理器、容器和完整 Linux 环境的活，还是归 WSL。</p>



<p class="wp-block-paragraph">来源：MakeUseOf</p>
]]></content:encoded>
					
					<wfw:commentRss>https://mylogs.cn/%e4%b8%ba%e4%ba%86%e5%87%a0%e6%9d%a1%e5%91%bd%e4%bb%a4%e5%bc%80-wsl%ef%bc%9f%e7%8e%b0%e5%9c%a8%e7%9c%9f%e6%b2%a1%e5%bf%85%e8%a6%81%e4%ba%86/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
