在 Linux 上運行 PowerShell

PowerShell 全稱 Windows PowerShell,在開發之初,微軟將其命名爲代號 Monad。它首先是個 Shell,它可以啓動和操縱應用程序;其次 PowerShell 也能夠將幾個命令組合起來放在文件中執行;同時,PowerShell 還能夠充分利用 .Net 和 COM 對象,來與各類系統交互,完成各類複雜、自動化的操做。
PowerShell 這個本來只是 Windows 才能使用的組件,於 2016 年 8 月 18 日開源而且成爲跨平臺軟件 ,登錄了 Linux 和 macOS。git

現在,你能夠在 GitHub 上下載,並體驗 PowerShell 和他的開源態度;固然你也能夠在在開源網站上下載並學習 PowerShell 資料庫。微軟的納德拉說:我愛 Linux,你以爲這事兒靠譜嗎?不如先行試用。github

在 Linux 系統中安裝 PowerShell

Ubuntu 14.04

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/14.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
sudo  apt-get update
sudo  apt-get install -y powershell
powershell

Ubuntu 16.04

curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
curl https://packages.microsoft.com/config/ubuntu/16.04/prod.list | sudo tee /etc/apt/sources.list.d/microsoft.list
apt-get update
apt-get install -y powershell
powershell

CentOS 7

sudo curl https://packages.microsoft.com/config/rhel/7/prod.repo > /etc/yum.repos.d/microsoft.repo
sudo yum install -y powershell

Debian Kali

下載 PowerShell-x86_64.AppImageshell

chmod +x PowerShell-x86_64.AppImage
./PowerShell-x86_64.AppImage

獲取 PowerShell 命令列表ubuntu

get-command

查看命令幫助 get-help command 好比 get-help Get-Processcurl

get-help Get-Process

相關文章
相關標籤/搜索