Skip to main content

Linux to PowerShell

LinuxPowerShellAliasExample
lsGet-ChildItemgcigci .
cdSet-Locationslsl C:\
pwdGet-Locationglgl
cpCopy-Itemcopycopy file1 file2
mvMove-Itemmovemove file1 newlocation
rmRemove-Itemdel, rmdir, rmdel file1
mkdirNew-Item -ItemType Directorymd, mkdirmd newfolder
rmdirRemove-Item -Recurserm, rmdirrm -r foldername
touchNew-Itemnini file.txt
catGet-Contentgcgc file.txt
echoWrite-Outputechoecho "Hello World"
findSelect-Stringslssls "pattern" file.txt
grepSelect-Stringslssls "pattern" file.txt
headGet-Content -Headgcgc -Head 10 file.txt
tailGet-Content -Tailgcgc -Tail 10 file.txt
wcMeasure-Objectmeasuregc file.txt
sortSort-Objectsortgci
uniqSelect-Object -Uniqueselectgc file.txt
diffCompare-Objectcomparecompare (gc file1) (gc file2)
chmodSet-AclSet-Acl file.txt -AclObject aclObject
chownSet-AclSet-Acl file.txt -AclObject aclObject
psGet-Processgpsgps
killStop-Processkill, sppskill -Name notepad
manGet-Helphelphelp Get-Content
historyGet-Historyhh
clearClear-Hostcls, clearcls