Windows power shell

Commands equivalent to Unix head, tail, more and sed

(get-content shorted to gc)
gc log.txt | select -first 10 # head 

gc log.txt | select -last 10 # tail 

gc log.txt | more

gc log.txt | %{ $_ -replace '\d+', '($0)' } # sed


Top 10 Commands

  • Get-Command retrieves a list of all available cmdlets.
  • Get-Help displays help information about cmdlets and concepts.
  • Get-WMIObject retrieves management information by using WMI.
  • Get-EventLog retrieves Windows event logs.
  • Get-Process retrieves a single or list of active processes.
  • Get-Service retrieves a Windows service.
  • Get-Content reads in text files, treating each line as a child object.
  • Add-Content appends content to a text file.
  • Copy-Item copies files, folders, and other objects.
  • Get-Acl retrieves access control lists (ACLs).