Linux Format

PowerShell

Version: 7.3.0 Web: https://github.com/PowerShell/PowerShell

-

Free and open source software from Microsoft that’s actually good is a rarity. One such gem is PowerShell, which interestin­gly supports all of the commonly known commands from CMD and Linux’s command-line shell.

PowerShell is made up of a command-line shell, a scripting language and a configurat­ion management framework. System admins use it for automating the management of the computers in their realm.

One of the difference­s that’ll strike first-time users when using PowerShell is the semantic clarity.

As anyone who has worked with traditiona­l POSIX shells like BASH knows, most commands are heavily abbreviate­d. For instance, commands such as awk , ps and top don’t make sense to a new user as the names don’t reveal the purpose of the command.

In contrast, commands in PowerShell are selfdescri­ptive. They are called cmdlets and follow the verb-noun naming convention. For instance, the cmdlet Get-Childitem | Where-Object Length -gt 50MB lists all files greater than 50MB in the current directory. That said, there are plenty of scenarios where standard Linux commands make more sense than PowerShell cmdlets. However, what’s particular­ly appealing about PowerShell is that it lets you use commands and cmdlets together.

For instance, consider Get-Process | Select-Object -Property Name, Path, Responding, Id | grep firefox .

Even though Get-Process returns a number of properties for processes running on the computer, we pipe the output through Select-Object to narrow down the list, which is further narrowed to display only details about the running Firefox process using grep .

Binary packages for PowerShell are available for several distros, but you can install it from the Snap store with sudo snap install powershell --classic . Once installed, use pwsh to switch to PowerShell.

 ?? ?? Use the “GetCommand” cmdlet to view a list of the available Linux PowerShell cmdlets.
Use the “GetCommand” cmdlet to view a list of the available Linux PowerShell cmdlets.

Newspapers in English

Newspapers from Australia