PowerShell: Difference between revisions

332 bytes added ,  19 October 2023
Comparison with Linux commands
Check for an open port
Tag: visualeditor
Comparison with Linux commands
Tag: visualeditor
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
== Check for an open port ==
== Check for an open port ==
<source lang="powershell">
<syntaxhighlight lang="powershell">
PS C:\Users\MHan> Test-NetConnection -ComputerName island.doodle.com -Port 443
P> Test-NetConnection -ComputerName island.doodle.com -Port 443
</source>
</syntaxhighlight>


== Search files ==
== Search files ==


<source lang="powershell">
<syntaxhighlight lang="powershell">
PS C:\Users\MHan> Get-ChildItem -Recurse -Include *.* | Select-String "text to search for"
PS C:\Users\MHan> Get-ChildItem -Recurse -Include *.* | Select-String "text to search for"
</source>
</syntaxhighlight>
 


== Check version ==
== Check version ==


<source lang="powershell">
<syntaxhighlight lang="powershell">
PS C:\Users\MHan> $PSversionTable
PS C:\Users\MHan> $PSversionTable


Line 26: Line 25:
SerializationVersion          1.1.0.1
SerializationVersion          1.1.0.1


</source>
</syntaxhighlight>
 
== Comparison with Linux commands ==
{| class="wikitable"
|+
!Action
!PowerShell
!Linux
|-
|Search for a string
|<nowiki>az keyvault list | findstr -i 'name":'</nowiki>
|<nowiki>az keyvualt list | grep -i 'name";'</nowiki>
|-
|Alias a command
|new-alias grep findstr
|alias g grep
|-
|
|
|
|}