![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=1738862729-zXIKR8jrOWhXBNAA6lOxfaPqoRGQCjju-0-636f845be2f709db7ed5dc31d6027ba5)
- 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=1738862729-iWMMptabcZvqidF6cKLyiyEhmwPI6THs-0-ecc3d3295647774c4ef2d0ea13eda642)
- 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=1738862729-KrD2cRhTIpEbpzliYWeNcxIvHgZAVHuY-0-7a8d2b1060cb22996b301c619203b617)
- Lastly, execute this cmdlet: Stop-Computer -WhatIf. This time, there's no comparable command on either Windows or Linux.