16.7 C
Amsterdam

How To Install PowerShell Core on Ubuntu 18.04 LTS

Introduction:

PowerShell is a scripting language tool built on the .NET Framework. It allows you to perform task automation and configuration management. PowerShell can be accessed easily on Windows but it is not available on Linux systems. In this guide, we will cover the process of Installing PowerShell on our Ubuntu 18.04 LTS. Follow the below steps to get started.

Run the given command to add the repository to your Ubuntu 18.04 system.

sudo apt-get update && sudo apt -y install wget
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

You will see similar output upon successful installation.

- Advertisement -
Selecting previously unselected package packages-microsoft-prod.
(Reading database … 105206 files and directories currently installed.)
Preparing to unpack packages-microsoft-prod.deb …
Unpacking packages-microsoft-prod (1.0-ubuntu18.04.1) …
Setting up packages-microsoft-prod (1.0-ubuntu18.04.1) …

After it update package index list and Install PowerShell by typing

sudo apt update
sudo apt -y install powershell

Testing PowerShell

To test powershell on your Ubuntu 18.04, try the following command

pwsh
PowerShell 6.1.1
https://aka.ms/pscore6-docs
Type 'help' to get help.
PS /home/vagrant>

Test Command Execution by running

PS /home/vagrant> Get-ChildItem / 
Directory: /
Mode LastWriteTime Length Name
---- ------------- ------ ----
1 d----- 10/29/18 11:19 PM bin
2 d----- 10/29/18 11:27 PM boot
3 d----- 12/18/18 1:25 PM dev
4 d----- 12/18/18 1:39 PM etc
5 d----- 10/29/18 11:17 PM home
6 d----- 10/29/18 11:21 PM lib
7 d----- 10/29/18 11:12 PM lib64
8 d----- 10/29/18 11:12 PM lost+found
9 d----- 10/29/18 11:12 PM media
10 d----- 7/24/18 7:51 PM mnt
11 d----- 12/18/18 1:39 PM opt
12 d-r--- 12/18/18 1:25 PM proc
13 d----- 12/18/18 1:40 PM root
14 d----- 12/18/18 1:40 PM run
15 d----- 10/29/18 11:21 PM sbin
16 d----- 10/29/18 11:18 PM snap
17 d----- 7/24/18 7:51 PM srv
18 d-r--- 12/18/18 1:25 PM sys
19 d----- 12/18/18 1:40 PM tmp
20 d----- 12/29/18 11:12 PM usr
21 d----- 12/29/18 11:15 PM var
22 -----l 12/29/18 11:21 PM 33 initrd.img
23 -----l 12/29/18 11:13 PM 33 initrd.img.old
24 -----l 12/29/18 11:21 PM 30 vmlinuz
25 -----l 12/27/19 11:13 PM 30 vmlinuz.old
PS /home/vagrant> dir
Directory: /home/vagrant
Mode LastWriteTime Length Name
---- ------------- ------ ----
--r--- 5/8/18 3:11 PM 2644 packages-microsoft-prod.deb
PS /home/vagrant>

- Advertisement -

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Donate to Osradar

Latest article