PowerShell commands cheat sheet


powershell

I'm much more comfortable using Bash over PowerShell, but there are definitely times that you need to use command line on Windows. So I keep a small, but growing list of my most commonly used cmdlets, their Linux-like aliases, and other must-know commands.

Cmdlets & Linux Equivalents

PowerShell cmdlets have aliases identical to their equivalent Linux commands, here’s the most common:

CommandAliasEffect
Get-LocationpwdShow current directory
Set-LocationcdChange to another directory
Get-ContentcatOutput contents of a file
New-itemtouchCreate a new file
Copy-ItemcpCopy a file
Move-ItemmvMove a file to new location
Remove-ItemrmDelete a file
Get-ChildItemlsOutput a list of directory contents
New-Item -ItemType DirectorymkdirCreate new directory

Advanced Commands

CommandEffect
shutdown /r /fw /f /t 0Reboot into BIOS immediately
ipconfig /flushdnsFlush DNS resolver cache (do this when having DNS issues)
ipconfigDisplay TCP/IP basic information (append /all for full info)
getmac /vList MAC addresses of all network adapters
powercfg /energyPower efficiency diagnostics report
powercfg /batteryreportBattery life diagnostics report
sfc /scannowScan system and repair any integrity violations
tasklistList all running processes and their process IDs
taskkill /f /pid 12345Kill a running task (specify process ID)

References