Now you can run PowerShell on both Linux and macOS

A cross-platform open source version of PowerShell called PowerShell Core 6.0 has just been released by Microsoft, not only running on Windows, but it can run on both macOS and Linux. In the near future, this version will also deploy with the original PowerShell we have used for 10 years.

Widely released from 10/1, PowerShell Core supports Windows 7+, Ubuntu, Redhat, Centos, macOS, Fedora, OpenSuse and Debian, allowing system administrators to use common administration scripting languages ​​to run on every server.

Microsoft has provided instructions for installing PowerShell Core for both macOS, Linux and Windows. On Windows, you only need to download and run the file to install PowerShell in parallel with the current PowerShell, thereby easily running the test and putting the current PowerShell script into PowerShell Core.

To install PowerShell on Linux and macOS, Microsoft releases packages for most Linux kernels. For example, installing PowerShell Core on Ubuntu 16.04, run the following command:

 # Import the public repository GPG keys 
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -

# Register the Microsoft Ubuntu repository
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list

# Update the list of products
sudo apt-get update

# Install PowerShell
sudo apt-get install -y powershell

# Start PowerShell
pwsh

Once installed, start from the console with the pwsh command .

Now you can run PowerShell on both Linux and macOS Picture 1
PowerShell Core on Ubuntu 16.0 4

Unfortunately, for PowerShell Core to work on many OSs, Microsoft has to give up quite a bit of technology.

To switch to .NET Core and other OSs, we are forced to abandon some of the technologies being used on Windows PowerShell. We take advantage of PowerShell refactor to stop supporting some of the less-used technologies. Some will return to PowerShell Core but many of them are not. At a high level, there are:

  1. PowerShell Workflows
  2. PowerShell Snap-ins
  3. WMIv1 cmdlets (Get-WmiObject, Invoke-WmiMethod .) Encourage using CIM / WMIv2 cmdlets (Get-CimInstance, Invoke-CimMethod .)
  4. The Desired State Configuration (DSC) Executing resources use PowerShell Core

We also have many minor language changes, the engine and PowerShell cmdlets, which can technically be considered breakthroughs. For more information, please read Breaking Change at: https://github.com/PowerShell/PowerShell/blob/master/docs/BREAKINGCHANGES.md.

These changes will prevent existing PowerShell scripts from working on the Core without modification.

See more:

  1. How are Command Prompt (cmd) and PowerShell different?
  2. Instructions on how to use PowerShell in Windows Server 2012
  3. How to restart the computer using PowerShell
4 ★ | 21 Vote

May be interested

  • How to use PowerShell's default parameter to change the command behaviorHow to use PowerShell's default parameter to change the command behavior
    many people like to use powershell because it allows them to do things that can't be done with the windows gui. however, it is undeniable that some powershell cmdlets can be tedious or complicated. but what if there is a way to edit these cmdlets and get them to 'behave' the way you want?
  • How to check PowerShell version in Windows 10How to check PowerShell version in Windows 10
    powershell is one of the extremely useful command tools for advanced windows 10 users.
  • Instructions on how to use PowerShell in Windows Server 2012Instructions on how to use PowerShell in Windows Server 2012
    what is powershell? windows powershell is a command-line shell language interpreter and scripting language specifically designed for system administrators. built on the .net framework, windows powershell helps it professionals control and automate windows operating system administration tasks as well as applications running on windows server environments.
  • What is Windows PowerShell? How to use Windows PowerShellWhat is Windows PowerShell? How to use Windows PowerShell
    do you want to learn the features of windows powershell but don't know how? suggestions for you what is windows powershell? the most convenient way to use windows powershell.
  • How to install Kali Linux on macOSHow to install Kali Linux on macOS
    since the release of kali linux 1.0.8, kali linux supports efi. this additional feature simplifies the process of installing and running potassium on various apple macbook air, pro and retina models.
  • What to do when Windows can't find PowerShell?What to do when Windows can't find PowerShell?
    powershell is a handy tool that allows you to automate tasks, fix various errors, and manage several windows installations. but what if it suddenly disappears from your computer?
  • PowerShell and everything you need to know about itPowerShell and everything you need to know about it
    what is powershell? microsoft powershell is a command line utility and scripting language that is a powerful tool for administrators that helps you automate a wide range of computer and network tasks.
  • Should I use PowerShell or Command Prompt?Should I use PowerShell or Command Prompt?
    for advanced windows users, the command line has long been a powerful tool for managing and interacting with the operating system. but powershell offers enhanced automation and scripting capabilities. so which tool should you use?
  • PowerShell securityPowerShell security
    if you've ever heard of powershell, you're probably wondering how powerful powershell is. with all the effort and effort spent, this scripting machine is now more mature with advanced security features. powershell is dry
  • How to Install or Update PowerShell on Windows 11How to Install or Update PowerShell on Windows 11
    windows powershell is a command line tool developed by microsoft that helps you automate common tasks on your system.