powershell
PowerShell 7+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관련 명령어 치트시트
상표 및 사용 안내
본 명령줄 도구 치트시트 모음은 오픈 커뮤니티 참고 자료입니다. 본 문서에서 언급되는 도구의 명칭, 로고, 상표(예: Git™, Docker™, Kubernetes®, kubectl, PostgreSQL®, MySQL®, Redis™, MongoDB®, Linux™, PowerShell™, Vim™ 등)는 각 권리자의 자산이며, 본 문서에서는 식별 및 참고 목적のみで 사용됩니다.
본 치트시트의 모든 내용은 독립적으로 작성된 단순화된 자체 완결형 참고 자료이며, 어떠한 공식 문서와도 계열·인정·출처 관계가 없습니다. 명령 목록, 플래그 설명, 예제는 모두 저자의 원본 단순화이며, 권위 있는 정보가 필요한 경우 각 도구의 공식 문서를 참조하시기 바랍니다.
명령 구문 및 옵션 플래그는 도구 버전에 따라 다를 수 있습니다. 표시되는 버전 태그는 안정 릴리스를 반영하며, 다른 버전에서는 동작이 다를 수 있습니다. 본 치트시트는 상표권자의 어떠한 선호나 권장도 의미하지 않습니다.
상표권자 또는 저작권자가 사이트의 일부 내용에 대해 권리 침해가 있다고 판단하시는 경우 [email protected]으로 이메일을 보내 주십시오. 유효한 권리 증명을 받은 후 합리적인 기간 내에 관련 내용을 수정하거나 삭제하겠습니다.
본 사이트는 사이트 정보의 이용으로 인해 발생하는 어떠한 직접적 또는 간접적 손해에 대해서도 법적 책임을 지지 않습니다.
PowerShell 소개
PowerShell은 2006년 마이크로소프트가 Windows 관리용으로 출시한 크로스 플랫폼 명령줄 셸이자 스크립트 언어입니다. 2016년 오픈 소스 재구현(PowerShell Core)과 2018년 통합을 거쳐 현재 안정 버전은 PowerShell 7+이며, Windows·macOS·대부분의 Linux 배포판에서 동작합니다. 기존 셸이 텍스트를 파이프로 전달하는 반면, PowerShell은 .NET 객체를 파이프라인으로 흘려보냅니다 — `Get-Process | Where-Object { $_.CPU -gt 100 }`. 덕분에 구조가 파이프라인을 따라 보존되고, 각 cmdlet이 발견 가능한 `-MemberName` 탭 완성을 제공합니다. 기본 동사-명사 명명 규칙(`Get-Item`, `Set-Variable`, `New-Item`)과 도움말 시스템(`Get-Help`, `-Examples`, `-Online`)이 언어 자체를 자기 문서화합니다. 수천 개의 cmdlet(`Microsoft.PowerShell.Management`, `Microsoft.PowerShell.Utility`, `PSReadLine` 같은 모듈)을 동봉하고, WinRM/SSH 기반 원격 처리, 최소 권한 위임을 위한 JEA, 선언적 구성을 위한 DSC를 지원합니다. Windows 자동화, Azure/M365 관리, 그리고 "객체 지향 파이프라인이 awk의 묘기보다 우월한" 모든 크로스 플랫폼 작업에 사용하세요. 실행 정책과 AMSI 스캔이 악성 스크립트를 차단할 수 있으니, `Get-ExecutionPolicy`로 확인하고 이해할 수 없는 인코딩된 명령은 절대 붙여넣지 마세요.
치트시트 버전 1.0.0