1 从https://github.com/PowerShell/PowerShell 下载powershell-6.1.1-linux-x64.tar.gz
2 安装依赖项
sudo apt-get install curl libunwind8 libicu60 liblttng-ust0 gdebi -y
3 用下面4条语句 建立目录 解压 增加可执行权限
sudo mkdir -p /opt/microsoft/powershell/6.1.0
sudo tar zxf powershell-6.1.1-linux-x64.tar.gz -C /opt/microsoft/powershell/6.1.0
sudo chmod +x /opt/microsoft/powershell/6.1.0/pwsh
sudo ln -s /opt/microsoft/powershell/6.1.0/pwsh /usr/bin/pwsh
4测试 用 pwsh 即可运行
下面是一些powershell的命令
$PSVersionTable
get-date
get-command
get-process
history