Note: PowerShell is object based, as opposed to byte stream based Unix utilities. This means text operations aren't that common, and also means many idioms aren't directly translateable.
var=text
->$var = object
cat file1 file2 file3 > target
->gc -Encoding Byte file1,file2,file3 | sc -Encoding Byte target
(binary concatenation, with text files you can specify different encoding or let it guess)curl
->iwr
(Invoke-WebRequest
)date
->date
(Get-Date
)man command-name
->help command-name
(Get-Help
)ps
->ps
(Get-Process
)seq 10
->1..10
sort
->sort
(Sort-Object
)uniq
->gu
(Get-Unique
)unset var
-.rv var
(Remove-Variable
)
Create a new object:
# equivalent to C#'s var d = new DateTime(2015, 3, 1);
2015, 3, 1 is an array here
$d = New-Object DateTime 2015, 3, 1
Create an object of a generic class:
# equivalent to C#'s var l = new SortedList<string, int>();
$l = New-Object 'Collections.Generic.SortedList[string, int]'
Call a method:
$d = $d.AddHours(4)
Access a property:
$month = $d.Month