2

windows powershell 实现类似 grep 的效果

 2 years ago
source link: https://hellodk.cn/post/414
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

windows powershell 实现类似 grep 的效果

windows powershell 下使用 ps 命令可以查看当前所有的 process name
但是如何才能像 linux 那样使用 ps |grep nginx 那样 只输出和字符串 nginx 相匹配的进程呢?

ps | Out-String -stream | sls nginx

20201215140413.png

可以实现类似 grep 的效果

关于 powershellOut-String 可以翻阅微软官方文档 https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-string?view=powershell-7.1

powershell 执行 ps 命令后每一列的含义见图
20201215140903.png


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK