about
10/31/2024
Help: PowerShell
Help: PowerShell
PowerShell commands for use in PowerShell terminal
About
click header to toggle Site Explorer
Synopsis:
PowerShell Command |
Action |
---|---|
Selection of frequently used PowerShell commands and options. To see all: use PowerShell -help
The left cell in each row contains a PowerShell command and commonly use aliases.
|
|
ls, dir, gci, Get-ChildItem |
list directory contents
syntax: ls [options] [path] options: -Force, -(R)ecurse, -Name, -File, -Directory, -Filter, -Include, -Exclude, -Depth, -Attributes example: ls -Filter *.zip display all zip files in current working directory example: ls -Hidden display all hidden files in current working directory example: ls -File | Select-String "Rust" | Select-Object -First 10 display first ten files containing string "Rust" - may also use regex example: ls -Path .. display all files and directories in parent directory |
cd |
change current working directory
example: cd ../PostDemos sets sibling PostDemos as current working directory |
pwd, gl, Get-Location | display current working directory |
rm, del, Remove-Item |
delete file or directory
syntax: rm [options] options: -Include, -Exclude, -Confirm, -Force, -WhatIf example: rm foodir removes directory foodir example: rm foo.txt removes file foo.txt |
cls, clear | clear contents of terminal |
cat, type, gc, Get-Content |
display text representation of object on terminal
syntax: cat [options] options: -Path, -(Head, H, First, TotalCount), -Tail, -Encoding, -Delimiter -Raw example: cat index.html -TotalCount 10 |
write, write-output, write-host, write-error, echo, Write-Output |
write to pipeline, stdout, stderr
syntax: write [options] options: -Object, -ForegroundColor, -BackgroundColor, ... example: write-host -ForegroundColor green "this is a string" "and another" "and a final" |
md, mkdir, New-Item |
create new directory
syntax: md [options] options: -Name, -Path, -ItemType, -Value, -Force, -NoClobber, -Credential, -WhatIf, -Confirm example: md foo -ItemType Directory |
ni, New-Item |
create new object
syntax: ni [options] options: -Name, -Path, -ItemType, -Value, -Force, -NoClobber, -Credential, -WhatIf, -Confirm example: ni foobar.txt or ni -Name foobar.txt creates file foobar.txt in current working directory example: ni LinkToFoo -ItemType SymbolicLink -Target foo.txt makes symbolic link to foo.txt |
man, help, Get-Help |
show help text
syntax: man [options] options: ls, cat, ... example: man ls |