PowerShell 명령어 치트시트
PowerShell cmdlet 빠른 참조: 탐색, 파일/시스템, 파이프라인 필터링 & 선택, 네트워킹, 원격 세션, 모듈 — 공통 파라미터와 실전 예시까지 정리했습니다.
명령어 34개
탐색 & 도움말
Get-Command [<name>]이름, 별칭, 와일드카드로 명령을 검색 — 사실상 PowerShell 의 man.
-Module <module>; -Noun / -Verb; -ParameterType; -All
Get-Command -Noun Service | Format-Table Name, ModuleGet-Help <cmdlet> [-Examples|-Detailed|-Full]cmdlet 의 도움말 표시: 개요, 구문, 파라미터, 예제.
-Examples; -Detailed; -Full; -Online 브라우저 열기; -ShowWindow GUI
Get-Help Get-Process -ExamplesGet-Module [-ListAvailable]세션에 로드된(또는 임포트 가능한) 모듈 목록.
-ListAvailable; -All; -Name 필터
Get-Module -ListAvailable | Sort-Object Name탐색 & FS
Set-Location / Get-Location / pwd현재 작업 디렉터리를 변경하거나 출력합니다.
Set-Location C:\projects\app; Get-LocationGet-ChildItem (alias ls/dir)파일과 하위 디렉터리 목록(-Recurse 로 재귀).
-Recurse; -Force 숨김 포함; -Filter <pattern>; -File / -Directory; -Depth
Get-ChildItem -Recurse -File -Filter *.log | Sort-Object Length -Descending | Select-Object -First 10New-Item -ItemType File/Directory <path>새 파일 또는 디렉터리 생성(기본: 파일).
-Force 덮어쓰기/부모 생성; -ItemType File|Directory|SymbolicLink; -Value 내용
New-Item -ItemType Directory -Path logs/2026 | Out-NullRemove-Item (alias rm/del)파일, 디렉터리, 레지스트리 키, 변수를 삭제합니다.
-Recurse; -Force; -Confirm:\$false 로 프롬프트 건너뛰기
Remove-Item -Recurse -Force build/, node_modules/Copy-Item / Move-Item / Rename-Item파일 시스템 항목 복사, 이동, 이름 변경.
-Recurse; -Force; -To; -Exclude / -Include 필터
Copy-Item -Recurse dist\* \\deploy\shares\app\Get-Content / Set-Content / Add-Content파일 내용 읽기/쓰기(Get-Content 의 -Tail 은 Unix tail 처럼 동작).
-Tail N; -Wait follow; -TotalCount N; -Encoding utf8/ASCII
Get-Content -Path app.log -Tail 50 -WaitTest-Path / Resolve-Path경로 존재 여부 확인(파일, 디렉터리, 레지스트리) 또는 와일드카드 해석.
-PathType Container|Leaf; -IsValid
if (Test-Path .\node_modules) { Remove-Item -Recurse .\node_modules }파이프라인 & 객체
Where-Object (alias ?)속성 또는 스크립트 블록으로 파이프라인 객체를 필터링합니다.
-Property / -Value 패턴 매치; -Like / -EQ / -GT ...; -CContains / -In
Get-Process | Where-Object { $_.WorkingSet64 -gt 200MB }Select-Object (alias select)특정 속성 선택, 중복 제거, 또는 N 개 항목으로 확장.
-Property 이름; -First / -Last N; -Skip N; -Unique; -ExpandProperty
Get-Service | Select-Object Name, Status, StartType | Format-TableForEach-Object (alias %)파이프라인의 각 객체에 대해 작업을 수행합니다.
-Begin / -Process / -End; PS7+ 의 -Parallel
Get-ChildItem *.csv | ForEach-Object { Import-Csv $_ | Group-Object Level }Sort-Object (alias sort)파이프라인 객체를 하나 이상의 속성으로 정렬합니다.
-Property; -Descending
Get-ChildItem | Sort-Object -Property Length -Descending | Select -First 5Group-Object (alias group)속성 값으로 객체 그룹화; `-NoElement` 는 개수만 반환합니다.
-Property; -NoElement; -CaseSensitive
Get-Content app.log | Group-Object | Sort-Object Count -DescendingMeasure-Object (alias measure)속성에 대한 숫자 통계(count, sum, min/max/avg) 계산.
-Sum / -Average / -Minimum / -Maximum; 텍스트용 -Line / -Word / -Character
Get-ChildItem -File -Recurse | Measure-Object -Property Length -Sum포맷
Format-Table / Format-List (ft / fl)파이프라인 객체를 테이블 또는 리스트로 렌더링 — 표시 전용.
-AutoSize; -Wrap; -GroupBy; -Property 부분집합
Get-Process | Format-Table Name, Id, @{n='Mem(MB)';e={[Math]::Round($_.WorkingSet64/1MB,1)}} -AutoSizeOut-File / Set-Content / Tee-Object출력을 파일로 기록; Tee-Object 는 파일과 파이프라인 양쪽에 기록.
Get-Service | Tee-Object -FilePath services.txt | Where-Object { $_.Status -eq 'Running' }문자열 & 변수
Select-String (alias sls)grep 의 동등물 — 패턴(정규식 인식)에 매치되는 줄을 찾습니다.
-Path; -Pattern; -SimpleMatch; -CaseSensitive; -Context N
Select-String -Path src\**\*.ts -Pattern 'TODO' -CaseSensitive:\$falseSet-Variable (alias set/sv)세션 또는 환경 변수를 정의합니다.
-Name; -Value; -Scope Global|Local|Script; -PassThru
Set-Variable -Name regions -Value @('eastus','westus') -Scope GlobalGet-Variable / $env:변수 목록/조회; $env: 드라이브로 프로세스 환경변수 읽기/쓰기.
$env:DATABASE_URL = 'postgres://localhost/dev'; Get-Variable | Out-GridViewGet-Alias / Set-Aliascmdlet 의 별칭을 나열하거나 정의합니다.
Set-Alias -Name grep -Value Select-String -Option ReadOnly -Scope Global프로세스 & 서비스
Get-Process / Start-Process / Stop-Process로컬 프로세스 조회, 시작, 중지(Stop-Process = kill).
-Name; -Id; -FileVersionInfo; -PassThru; kill 은 -Force
Get-Process node | Sort-Object -Property WorkingSet64 -Descending | Select -First 5Get-Service / Start-Service / Stop-ServiceWindows 서비스 조회, 시작, 중지.
-Name; -DisplayName; -Status Running|Stopped
Get-Service | Where-Object Status -eq Stopped | Format-Table Name, StartupType네트워킹
Test-NetConnection <host>TCP 연결성, 지연, (-Port 와 함께) 도달 가능성 진단.
-Port; -InformationLevel Detailed; -DiagnoseRouting
Test-NetConnection api.example.com -Port 443Invoke-WebRequest / Invoke-RestMethodHTTP 클라이언트(RestMethod 는 JSON 을 곧바로 객체로 파싱).
-Method GET/POST/PUT/DELETE; -Headers @{...}; -Body (json); -OutFile path; -SkipHttpRedirect; -UseBasicParsing
Invoke-RestMethod -Uri https://api.github.com/repos/powershell/powershell/releases/latest | Select-Object tag_name, html_urlResolve-DnsName / Get-NetIPAddressDNS 레코드 조회 및 로컬 IP 설정 확인.
-Type A/AAAA/MX/CNAME; -Server 8.8.8.8; -AddressFamily IPv4/IPv6
Resolve-DnsName example.com -Type MX원격 & 모듈
Enter-PSSession / Invoke-Command원격 머신에서 세션 시작 또는 명령 실행(WinRM / SSH).
-ComputerName / -HostName; -Credential; -ConfigurationName; -FilePath
Invoke-Command -ComputerName web01,web02 -FilePath .\deploy.ps1Import-Module / Find-Module / Install-Module세션에 모듈을 로드하거나 저장소에서 가져옵니다.
-Force 재로드; -Scope Global/CurrentUser; -AcceptLicense; -AllowClobber
Install-Module -Name Az -Scope CurrentUser -AcceptLicenseGet-Module / Remove-Module로드된 모듈 목록 또는 세션에서 모듈 언로드.
Get-Module | Format-Table Name, Version, ExportedCommands.Count시스템
Get-Date / Set-Date풍부한 포맷으로 현재 날짜/시간을 읽거나 변경합니다.
-Format; -UFormat; -DisplayHint; -Culture
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'Get-CimInstance Win32_OperatingSystemCIM/WMI 를 통한 하드웨어/시스템 정보(메모리, 디스크, OS, BIOS 등).
-ClassName; -ComputerName; -Filter 쿼리
Get-CimInstance Win32_LogicalDisk -Filter "DeviceID='C:'" | Select DeviceID, @{n='FreeGB';e={[Math]::Round($_.FreeSpace/1GB,2)}}Get-History / Invoke-History (alias h/r)현재 세션에서 최근 실행한 명령을 다시 실행합니다.
-Count N; -Id N 특정 항목 재실행
Get-History | Where-Object CommandLine -like 'Get-*' | Invoke-History$PROFILE / Update-Help프로필(시작 스크립트)을 편집하고 cmdlet 도움말을 새로 고칩니다.
notepad $PROFILE; Update-Help -Force치트시트 버전 1.0.0
PowerShell 7+ 대응