Introduction to PowerShell for Unix People by Powershell.org - HTML preview
Download the book in PDF, ePub, Kindle for a complete version.
9. commands detail - f
find
The bash find command has loads of functionality - I could possibly devote many pages to Powershell equivalents of the various options, but at it’s simplest the bash find does this:

The simplest Powershell equivalent of the bash find is simply to stick a -recurse on the end of a dir command

If you want Powersehll to give you output that looks more like the Unix find then you can pipe into | select fullname
![]()

for
for loop - start, stop, step
The equivalent of this bash:

…is

for loop - foreach item in a list
For the Bash
for I in Chelsea Arsenal Spuds do echo $I done
the equivalent Powershell is:for
each ($Team in ("Chelsea", "Arsenal", "Spuds")) {write-output $Team}
for loop - for each word in a string
For the bash:
![]()
…the equivalent Powershell is:
![]()
for loops - for lines in a file
Bash:

Posh:
![]()
or:
![]()
for loop - for each file in a folder
Bash:

Posh:
![]()
