전체 치트시트

PowerShell 명령어 치트시트

PowerShell cmdlet 빠른 참조: 탐색, 파일/시스템, 파이프라인 필터링 & 선택, 네트워킹, 원격 세션, 모듈 — 공통 파라미터와 실전 예시까지 정리했습니다.

명령어 34개

탐색 & 도움말

Get-Command [<name>]

이름, 별칭, 와일드카드로 명령을 검색 — 사실상 PowerShell 의 man.

-Module <module>; -Noun / -Verb; -ParameterType; -All

Get-Command -Noun Service | Format-Table Name, Module
Get-Help <cmdlet> [-Examples|-Detailed|-Full]

cmdlet 의 도움말 표시: 개요, 구문, 파라미터, 예제.

-Examples; -Detailed; -Full; -Online 브라우저 열기; -ShowWindow GUI

Get-Help Get-Process -Examples
Get-Module [-ListAvailable]

세션에 로드된(또는 임포트 가능한) 모듈 목록.

-ListAvailable; -All; -Name 필터

Get-Module -ListAvailable | Sort-Object Name

탐색 & FS

Set-Location / Get-Location / pwd

현재 작업 디렉터리를 변경하거나 출력합니다.

Set-Location C:\projects\app; Get-Location
Get-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 10
New-Item -ItemType File/Directory <path>

새 파일 또는 디렉터리 생성(기본: 파일).

-Force 덮어쓰기/부모 생성; -ItemType File|Directory|SymbolicLink; -Value 내용

New-Item -ItemType Directory -Path logs/2026 | Out-Null
Remove-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 -Wait
Test-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-Table
ForEach-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 5
Group-Object (alias group)

속성 값으로 객체 그룹화; `-NoElement` 는 개수만 반환합니다.

-Property; -NoElement; -CaseSensitive

Get-Content app.log | Group-Object | Sort-Object Count -Descending
Measure-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)}} -AutoSize
Out-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:\$false
Set-Variable (alias set/sv)

세션 또는 환경 변수를 정의합니다.

-Name; -Value; -Scope Global|Local|Script; -PassThru

Set-Variable -Name regions -Value @('eastus','westus') -Scope Global
Get-Variable / $env:

변수 목록/조회; $env: 드라이브로 프로세스 환경변수 읽기/쓰기.

$env:DATABASE_URL = 'postgres://localhost/dev'; Get-Variable | Out-GridView
Get-Alias / Set-Alias

cmdlet 의 별칭을 나열하거나 정의합니다.

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 5
Get-Service / Start-Service / Stop-Service

Windows 서비스 조회, 시작, 중지.

-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 443
Invoke-WebRequest / Invoke-RestMethod

HTTP 클라이언트(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_url
Resolve-DnsName / Get-NetIPAddress

DNS 레코드 조회 및 로컬 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.ps1
Import-Module / Find-Module / Install-Module

세션에 모듈을 로드하거나 저장소에서 가져옵니다.

-Force 재로드; -Scope Global/CurrentUser; -AcceptLicense; -AllowClobber

Install-Module -Name Az -Scope CurrentUser -AcceptLicense
Get-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_OperatingSystem

CIM/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+ 대응