You can use PowerShell cmdlet Select-Object to get top and bottom n rows in PowerShell output. Select-Object works as Unix head or tail command in PowerShell. Let me give you some examples
Get top 10 rows from PowerShell output
1 |
Get-Command | Select-Object -First 10 |
Get bottom 10 rows from PowerShell output
1 |
Get-Command | Select-Object -Last 10 |
Bonus 🙂 – Get unique rows in PowerShell output
1 |
Get-Process | Select-Object ProcessName -Unique |