PowerShell on RHEL in One Minute

While not specifically related to .NET on Linux, PowerShell on Linux is available and — let’s face it — if you’re a Windows developer you’re using PowerShell.

If you’re not using PowerShell, now is the time to start. While bash is the traditional Linux shell, PowerShell gives you the advantage of objects. In PowerShell, everything is an object, with properties you can directly access. It’s also a very powerful object-oriented scripting language, with classes and methods, much like any OOP language.

Add to that the fact that you now have one scripting language for any platform, and PowerShell may (should in my not-so-humble opinion) become your shell and scripting language of choice.

(Hint: If you aren’t using PowerShell, here is your opportunity to turn your coding skills up to 11.)

Let’s take a minute and install PowerShell on your Red Hat Enterprise Linux machine. The installation is only three steps (one of which may be optional):

Step 1: Install wget

sudo yum install -y wget

This installs the wget (web get?) command which allows you to download from the command line. This may already be installed on your machine, in which case this step is optional.

Step 2: Download the package

wget https://github.com/PowerShell/PowerShell/releases/download/v6.0.0-alpha.15/powershell-6.0.0_alpha.15-1.el7.centos.x86_64.rpm

This downloads the package into the current directory.

Step 3: Install PowerShell

sudo yum install -y powershell-6.0.0_alpha.15-1.el7.centos.x86_64.rpm

This installs PowerShell.

Proving The Installation

To prove your installation, simply type powershell at the Linux command line. You should see a PowerShell prompt open up.

To see PowerShell in action, use any valid command. I like to use the basic Get-Process command.

That’s it. You’ve installed PowerShell on your RHEL machine. This can help minimize the learning curve of working in Linux and/or make your environments more similar.

Join the Red Hat Developer Program (it’s free) and get access to related cheat sheets, books, and product downloads.


What did you think of this article?
-1+1 (No Ratings Yet)

Leave a Reply