Skip to content

Instantly share code, notes, and snippets.

@morriekken
Last active April 10, 2019 06:35
Show Gist options
  • Save morriekken/2d673538dcfbabc049f47560807c38de to your computer and use it in GitHub Desktop.
Save morriekken/2d673538dcfbabc049f47560807c38de to your computer and use it in GitHub Desktop.
PowerShell one line snippets
# Get first 10 lines
Get-Content ./log.log -First 10
# Get last 10 lines
Get-Content ./log.log -Tail 10
# Get last 10 lines and wait for new to arrive
Get-Content ./log.log -Wait -Tail 10
# Search for string in files in current directory and subdirectories
Get-ChildItem -recurse | Select-String -pattern "TEXTTOFIND" | group path | select name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment