补充一份安装方式:

在 PowerShell 中输入:
New-Item $profile -force -itemtype file
notepad $profile

在弹出编辑器中加入以下内容(具体需要删除哪些 alias 可能和 PowerShell 版本有关,自行修改; curl 和 wget 是我夹带私货,自行考虑要不要删):
remove-item alias:cat
remove-item alias:cp
remove-item alias:echo
remove-item alias:ls
remove-item alias:mv
remove-item alias:ps
remove-item alias:pwd
remove-item alias:rm
remove-item alias:rmdir
remove-item alias:curl
remove-item alias:wget

然后 . $profile 或重启 PowerShell

安装 scoop,然后 scoop install uutils-coreutils
(不建议用 winget,winget 打的包没有创建各命令的 alias,需要手工创建)

重启 PowerShell,检查 ls --help 是否为 uutils 的结果


参考文献:
1. https://gist.github.com/devwolf75/85a14b6ca46df83e6f154bbf9e842529
2. https://github.com/uutils/coreutils/discussions/4804 How to remove PowerShell aliases for Scoop installs of tools like Coreutils and other GNU applications
 
 
Back to Top