How to Install PowerShell on LMDE 5 “Elsie”

Microsoft PowerShell is a versatile and industry-leading scripting language that can be used for automation. It is also often paired with other technologies like CI/CD platforms, making it possible to build solutions without much effort quickly! No matter what kind of input you are looking at, whether it’s text or object data, PowerShell will return .NET objects when executed; this means there is no need whatsoever to parse out information from output messages since all values are already inside them.

In the following tutorial, you will learn how to install PowerShell on LMDE 5, better known as Linux Mint Debian Edition 5. The tutorial will use the command line terminal with complete steps to install the official repository and tips on updating and removing the software securely and adequately.

Update Linux Mint Debian Edition

Before proceeding with the tutorial, it is good to ensure your system is up-to-date with all existing packages.

sudo apt update && sudo apt upgrade

Install Required Packages

The following dependencies will need to be installed. Most of these packages would already be present on your system, but running the command can help ensure they’re installed.

sudo apt install software-properties-common apt-transport-https wget -y

Install PowerShell

First, you will need to import the GPG and the repository. Luckily this is straightforward, and you will always have the most up-to-date version available on your system.

Import the GPG key using the following command.

sudo wget -O- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo tee /usr/share/keyrings/powershell.gpg

Next, import the repository.

echo deb [arch=amd64,armhf,arm64 signed-by=/usr/share/keyrings/powershell.gpg] https://packages.microsoft.com/debian/11/prod bullseye main | sudo tee /etc/apt/sources.list.d/powershell.list

Once done, run an APT update to reflect the new additional repository.

sudo apt update

Now you can install PowerShell using the following command.

sudo apt install powershell -y

Activate PowerShell

Now that you have completed the installation to activate PowerShell, use the following command.

pwsh

Example of PowerShell Instance:

How to Install PowerShell on LMDE 5 "Elsie"

And that is it, and you have successfully installed the latest PowerShell.

PowerShell Commands Example

Now that you have logged into your terminal, some common examples of using PowerShell are as follows.

Print Help

help

Detail PowerShell information

Get-Host

List a directory

dir

Print previous command history

Get-History

List process information

Get-Process

Exit PowerShell instance

exit

How to Update PowerShell

To check for updates using the command line, use the following command to allow a blanket check for any updates across all APT packages.

sudo apt update && sudo apt upgrade

How to Remove (Uninstall) PowerShell

When you no longer want PowerShell installed on your system, use the following command to remove it.

sudo apt autoremove powershell -y

Next, remove the repository using the following command.

sudo rm /etc/apt/sources.list.d/powershell.list

For good housekeeping and security, remove the GPG key as follows.

sudo rm /usr/share/keyrings/powershell.gpg

Comments and Conclusion

Microsoft PowerShell is a powerful tool that can be used for system management and automation. If you’re not already familiar with PowerShell, we encourage you to check it out. It’s a great way to save time and automate tedious tasks.

More information about PowerShell and how to use it, amongst many other things, can be found in the official documentation.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!