Windows PowerShell 增强方案

PowerShell 和 Windows PowerShell 是两个独立的产品,虽然名字相似,但底层技术和定位完全不同 Windows PowerShell 是 2006 年随 Windows 推出的“老将”,基于 .NET Framework,只能跑在 Windows 上。 PowerShell 7(早期叫 PowerShell Core)是微软在 2016 年开源的“继任者”,基于跨平台的 .NET Core / .NET 5+ 重写。它不仅能跑在 Windows 上,还能跑在 Linux 和 macOS 上 一、升级到 PowerShell 7 Windows 自带的 PowerShell 5.1 基于 .NET Framework,启动速度和模块加载效率都不理想。PowerShell 7 基于 .NET Core,启动更快,且与 5.1 并行运行,安装后不会覆盖系统原有的 powershell.exe 安装方式(WinGet) winget install --id Microsoft.PowerShell --source winget 安装完成后,可执行文件为 pwsh.exe,在 Windows Terminal 中新建标签页时选择 “PowerShell” 即可使用。官方安装文档(MSI、ZIP 等其他方式):在 Windows 上安装 PowerShell 7 - Microsoft Learn-1...

2025年07月08日 · 2 min · Leanku

witr 系统诊断工具

witr 使用指南:从“什么在运行”到“为什么在运行” 一、介绍 witr 是一个用 Go 编写的系统诊断工具,名称来自它要回答的核心问题:“Why is this running?”(这为什么在运行?)。 传统的 ps、top、lsof、ss 告诉你的是一堆“事实”——哪个进程在跑、哪个端口被占。witr 做的事不一样:它把这些事实串成一条因果链。你给它一个 PID、端口或容器名,它往上追溯:是谁启动了它?是 systemd 服务、Docker Compose、npm dev server,还是某个 SSH 会话? 它的定位是“在经典可观测性命令之上的一层因果解释”,尤其适合开发者在本地机器、容器、服务管理器和语言特定的开发服务器之间来回切换时使用。 github地址:https://github.com/pranshuparmar/witr 二、安装 witr 的安装方式覆盖了几乎所有主流平台和包管理器。以下按平台分类。 Windows # Winget(推荐) winget install -e --id PranshuParmar.witr # Scoop scoop install main/witr # Chocolatey choco install witr # 一行式 PowerShell 脚本 irm https://raw.githubusercontent.com/pranshuparmar/witr/main/install.ps1 | iex Windows 版本使用 Get-CimInstance、tasklist、netstat 收集信息,不需要 WSL 或 PowerShell 兼容层。 macOS / Linux # Homebrew(macOS 和 Linux) brew install witr # 通用一行式脚本 curl -fsSL https://raw....

2025年07月08日 · 2 min · Leanku