Skip to content

Instantly share code, notes, and snippets.

@yunga
Last active April 4, 2024 07:50
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save yunga/9a84491a4e329596bfc3216b458814a3 to your computer and use it in GitHub Desktop.
Save yunga/9a84491a4e329596bfc3216b458814a3 to your computer and use it in GitHub Desktop.
Dos/Unix/Powershell Commands

Powershell Rosetta Stone

CMD Unix Powershell Synopsis
HELP man Get-Help Displays information about commands and concepts.
apropos Get-Command Gets all commands.
Show-Command Displays PowerShell commands in a graphical window.
df Get-PSDrive Gets drives in the current session.
mount New-PSDrive Creates temporary and persistent mapped network drives.
umount Remove-PSDrive Deletes PowerShell drives and disconnects mapped network drives.
CD pwd Get-Location Gets information about the current location or a location stack.
CD cd Set-Location Sets the current working location to a specified location.
MD mkdir New-Item Creates a new item. (-ItemType Directory)
PUSHD [pushd] Push-Location Adds the current location to the top of a location stack.
POPD [popd] Pop-Location Changes the current location to the last pushed onto the stack.
DIR ls Get-ChildItem Gets the files and folders in a file system drive.
find Get-ChildItem Gets the files and folders in a file system drive. (-Name)
-d Test-Path Determines whether all elements of a path exist.
dirname Split-Path Returns the specified part of a path.
basename Split-Path Returns the specified part of a path. (-Leaf)
CACLS chown chmod Get-Acl Gets the security descriptor for a resource.
CACLS chown chmod Set-Acl Changes the security descriptor of a resource.
touch New-Item Creates a new item. (-ItemType File)
COPY cp Copy-Item Copies an item from one location to another.
REN Rename-Item Renames an item in a Windows PowerShell provider namespace.
MOVE mv Move-Item Moves an item from one location to another.
DEL rm Remove-Item Deletes files and folders.
truncate Clear-Content Deletes the contents of an item, but does not delete the item.
CLS clear Clear-Host Clears the display in the host program.
SET /P read Read-Host Reads a line of input from the console.
ECHO echo Write-Output Sends the specified objects to the next command in the pipeline.
TYPE cat Get-Content Gets the contents of an item.
head Get-Content Gets the contents of an item. (-Head 10) (-Wait for -f)
tail Get-Content Gets the contents of an item. (-Tail 10) (-Wait for -f)
tee Tee-Object Outputs in a file or variable and down the pipeline.
FINDSTR grep Select-String Finds text in strings and files.
Where-Object Selects objects from a collection based on their property values.
cut Select-Object Selects objects from a collection based on their property values.
SORT sort Sort-Object Sorts objects by property values. (-Unique)
uniq Get-Unique Returns unique items from a sorted list.
wc Measure-Object Calculates the numeric properties of objects,or strings.
FC diff Compare-Object Compares two sets of objects.
column Format-Table Formats the output as a table.
Format-List Formats the output as a list of properties on a new line (*)
Out-GridView Sends output to an interactive table in a separate window.
lp Out-Printer Sends output to a printer.
jq ConvertFrom-Json Converts a JSON-formatted string to a custom object.
csvtool ConvertFrom-Csv Converts object properties in comma-separated value format.
SYSTEMINFO uname Get-ComputerInfo Gets a consolidated object of system properties.
SHUTDOWN shutdown Stop-Computer Stops (shuts down) local and remote computers.
reboot Restart-Computer Restarts the operating system on local and remote computers.
systemctl Get-Service Gets the services on the computer.
systemctl Start-Service Starts one or more stopped services.
systemctl Stop-Service Stops one or more running services.
TASKLIST ps Get-Process Gets the processes running on a local or remote computer.
TASKKILL kill Stop-Process Stops one or more running processes.
time Measure-Command Measures the time it takes to run script blocks and cmdlets.
strace Trace-Command Traces of the specified expression or command.
TIMEOUT sleep Start-Sleep Suspends the activity for the specified period of time.
PING ping Test-Connection Sends ICMP echo request ("pings") to one or more computers.
TRACERT traceroute Test-Connection Sends ICMP echo request ("pings") to one or more computers.
NSLOOKUP dig Resolve-DnsName
IPCONFIG ip addr Get-NetIPConfiguration Gets IP network configuration.
Get-NetIPAddress Gets the IP address configuration.
ROUTE ip route Get-NetRoute Gets the IP route information from the IP routing table.
ARP ip neighbor Get-NetNeighbor Gets neighbor cache entries.
NETSTAT ss Get-NetTCPConnection Gets TCP connections.
curl Invoke-WebRequest Gets content from a web page on the Internet.
DATE date Get-Date Gets the current date and time.
$RANDOM Get-Random Gets a random number, or selects objects from a collection.
CLIP xclip Get-Clipboard Gets the contents of the clipboard.
CLIP xclip Set-Clipboard Sets the contents of the clipboard.
NET useradd New-LocalUser Creates a local user account.
NET userdel Remove-LocalUser Deletes local user accounts.
NET groupadd New-LocalGroup Creates a local security group.
NET groupdel Remove-LocalGroup Deletes local security groups.
NET groupmod Add-LocalGroupMember Adds members to a local group.
NET groupmod Remove-LocalGroupMember Removes members from a local group.
Get-Member Gets the properties and methods of objects.
Select-Object Selects objects or object properties.
ForEach-Object Operates against each item in a collection of input objects.
Where-Object Selects objects from a collection based on their property values.
Group-Object Groups objects with the same value for specified properties.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment