![Powershell Core 6.2 Cookbook](https://wfqqreader-1252317822.image.myqcloud.com/cover/704/36698704/b_36698704.jpg)
上QQ阅读APP看书,第一时间看更新
How to do it...
Let's perform the following steps:
- On Windows, run pwsh.exe. On Linux or macOS, run pwsh.
- Type your first cmdlet, Get-Process, to retrieve a list of running processes on the system and hit Enter to confirm.
- Compare the output of the cmdlet with the output of tasklist (in Windows) and ps (in Linux):
![](https://epubservercos.yuewen.com/57DF63/19470379901495806/epubprivate/OEBPS/Images/b4b39c91-def4-49c5-b6ac-73319df486f4.png?sign=1739236174-awg8tbp1ZSCCCENPSECpA5YyRaDSr6jV-0-986fa442e0676237fe011d6c930ba46f)
- Type Get-Date and hit Enter to confirm.
- Compare the output of this cmdlet with the output of date /t (in Windows) and date (in Linux):
![](https://epubservercos.yuewen.com/57DF63/19470379901495806/epubprivate/OEBPS/Images/a4e09474-dd37-4517-b30d-022199895fd9.png?sign=1739236174-pRQm9ar0zMs9aTimN1xfPdfREEE8Boz4-0-0283a43376dc6e3dc1df7e3d4f117af1)
- Execute the line: Get-Process | Where-Object -Property WorkingSet -gt 100MB.
- Compare the output again with the output of tasklist /FI "MEMUSAGE gt 102400" (in Windows) and ps -aux | awk -F" " '$5 > 102400' (in Linux):
![](https://epubservercos.yuewen.com/57DF63/19470379901495806/epubprivate/OEBPS/Images/8d1774b9-7339-4dd3-8a7e-96368538dff2.png?sign=1739236174-zj5BX4UteTiMCYnxIfPLt7w0XOSqb93v-0-a097fde559edb88d04dfa85cd36c1643)
- Lastly, execute this cmdlet: Stop-Computer -WhatIf. This time, there's no comparable command on either Windows or Linux.