常用对照
| 用途 | PowerShell | bash(信创) |
|---|---|---|
| 列文件 | Get-ChildItem | ls / find |
| 进程 | Get-Process | ps -ef / top |
| 服务 | Get-Service | systemctl |
| 磁盘 | Get-Volume | df -h / lsblk |
| 连通测试 | Test-NetConnection | ping / nc -vz |
| 文本搜索 | Select-String | grep -r |
| 计划任务 | Get-ScheduledTask | crontab -l / systemctl list-timers |
示例
示例
# PowerShell: Get-Process | Where-Object CPU -gt 60
ps -eo pid,pcpu,comm --sort=-pcpu | head
# PowerShell: Test-NetConnection 10.0.0.9 -Port 443
nc -vz 10.0.0.9 443管道语义不同:bash 处理文本流、PowerShell 处理对象;复杂脚本建议重写而非逐行翻译。