PowerShell: Difference between revisions
mNo edit summary |
Comparison with Linux commands Tag: visualeditor |
||
Line 1: | Line 1: | ||
== Check for an open port == | == Check for an open port == | ||
<syntaxhighlight lang="powershell"> | <syntaxhighlight lang="powershell"> | ||
P> Test-NetConnection -ComputerName island.doodle.com -Port 443 | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 9: | Line 9: | ||
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" | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== Check version == | == Check version == | ||
Line 27: | Line 26: | ||
</syntaxhighlight> | </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 | |||
|- | |||
| | |||
| | |||
| | |||
|} |
Revision as of 08:47, 19 October 2023
Check for an open port
P> Test-NetConnection -ComputerName island.doodle.com -Port 443
Search files
PS C:\Users\MHan> Get-ChildItem -Recurse -Include *.* | Select-String "text to search for"
Check version
PS C:\Users\MHan> $PSversionTable
Name Value
---- -----
PSVersion 5.0.10586.1417
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.10586.1417
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Comparison with Linux commands
Action | PowerShell | Linux |
---|---|---|
Search for a string | az keyvault list | findstr -i 'name":' | az keyvualt list | grep -i 'name";' |
Alias a command | new-alias grep findstr | alias g grep |