This article introduces how to display CPU usage from the command line such as Linux’s WSL Bash, Windows’ cmd.exe, and PowerShell.

For Bash:
grep 'cpu ' /proc/stat | awk '{usage=($2+$4)*100/($2+$4+$5)} END {print usage "%"}'
bash - How to get overall CPU usage (e.g. 57%) on Linux - Stack Overflow
For PowerShell:
$( Get-WmiObject win32_processor | Measure-Object -property LoadPercentage -Average | Select Average ).Average
How do I find the CPU and RAM usage using PowerShell? - Stack Overflow
For reference if you want to do it in C#: