How to Install PowerShell 7 On Ubuntu 18.04
Microsoft PowerShell Core is a cross-platform and open-source command-line tool and it built on the top of .NET Framework.
This is specially designed for system administrators to automate the daily task.
PowerShell core includes an interactive prompt and a scripting environment that we can be used independently.
Recently PowerShell core used for task automation and configuration management on cloud environment using command-line shell and associated scripting language.
- Powershell is open source
- Based on .NET Core
- Great tool for Linux Admin
- A Cross-Platform Tool
- You should have sudo or root level privileges.
Update the packages
# sudo apt-get update # sudo apt-get upgrade
Download and Import Microsoft GPG Keys
# wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb # sudo dpkg -i packages-microsoft-prod.deb
root@linuxfork:~# wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb root@linuxfork:~# sudo dpkg -i packages-microsoft-prod.deb Selecting previously unselected package packages-microsoft-prod. (Reading database … 76573 files and directories currently installed.) Preparing to unpack packages-microsoft-prod.deb … Unpacking packages-microsoft-prod (1.0-ubuntu18.04.2) … Setting up packages-microsoft-prod (1.0-ubuntu18.04.2) … root@linuxfork:~#
Now again we need to update the package list using apt-get command.
# sudo apt-get update
Enable the “universe” repositories
If you have completed the previous step successfully then the “universe repository” was already enabled. for verification let check it using the below command.
# sudo add-apt-repository universe
Now we can install the Microsoft Powershell core on the Linux system using below command.
# sudo apt-get install powershell
Start Powershell Prompt
As of now, we have installed the PowerShell core in the system now we can start the PowerShell Prompt using pwsh command.
Check Version of Powershell
List the Powershell Command
Check Current Path
By using the below command we can get the current location where we are working on the system. we can also say it will show your present working directory. As we can see below my current working directory is /root on my system.
PS /root> Get-Location Path /root PS /root>
List the file and folder in the current director
The below command will help you to list all the files and directory on your current location. as we can see We have a directory called linuxfork and two different files. Here directory represented by d and file by –.
That’s all in this article, we have learned how to install PowerShell Core on Ubuntu Linux 18.04. we hope it will help you. if you are still facing any issue to install it. please let us know in the comment section.
I am a professional Cloud Engineer and founder of LinuxFork. I am working on Infrastructure Deployment and focusing on the integration of open source technologies with the Cloud. I am an avid Linux lover and open source enthusiast. mostly, I am working with Redhat and Ubuntu Linux in the production environment. apart from this I always believe in knowledge sharing.