Loading...
X

How to install PowerShell on Arch Linux, Manjaro, BlackArch

PowerShell on Linux

PowerShell is a cross-platform automation and configuration tool/platform. PowerShell has a large number of system administration-oriented commands. But at the same time, PowerShell is a full-fledged programming language that allows you to write functional programs (scripts).

Note that PowerShell 5 is currently preinstalled on Windows by default, but this manual shows the installation of the latest version of PowerShell 7. On Windows, you can also install PowerShell 7.

Due to the differences between Windows and Linux operating systems, not all PowerShell functions work on Linux.

Installing PowerShell 7 on Arch Linux, Manjaro, BlackArch

It is recommended to install the pikaur utility according to the article “Automatic installation and update of AUR packages” and then just run the command:

pikaur -S powershell-bin

If you don't want to install pikaur, then run the following command sequence to install PowerShell:

git clone https://aur.archlinux.org/powershell-bin.git
cd powershell-bin
makepkg -si

How to run PowerShell on Arch Linux, Manjaro, BlackArch

To start an interactive PowerShell session, run the command:

pwsh

Linux PowerShell Examples

To list all PS commands on your computer, open PowerShell (pwsh command), and enter there:

Get-Command

It is possible to filter the information displayed by the Get-Command command. Let's say you want to see PowerShell commands containing the word “Alias”, for this you need to run the following command:

Get-Command -Name *Alias

To display help about a command (cmdlet) use the following:

Get-Help COMMANDLET

For example, to display help about the Get-Alias cmdlet:

Get-Help Get-Alias

To get the most complete help on Get-Command, do the following:

Get-Help Get-Command -Full

To display the contents of a folder (in this case the root of the file system), run:

Get-ChildItem /

To list processes run:

Get-Process

To stop the process with ID 10500 use the command as shown below:

Get-Process -Id 10500 | Stop-Process

See also “Linux PowerShell Basics (Beginner's Guide)”.


Leave Your Observation

Your email address will not be published. Required fields are marked *