How To Install PowerShell Core on Ubuntu 18.04 LTS

Windows Articles

Top 8 features for power users in Windows 10

Hello! Windows 10 is full of features and functions. In fact, that's one of the reasons it's so popular and used. Because it can...

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...

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.

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>

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

Top 8 features for power users in Windows 10

Hello! Windows 10 is full of features and functions. In fact, that's one of the reasons it's so popular and used. Because it can...

How to access System in Windows 10

Perhaps the title of this post is misleading. In previous versions of Windows, it was enough to enter the Control Panel and from there,...

Microsoft reduces the fragmentation of Windows 10

Windows 10 20H2 has been released as a minor operating system update. As a result, it has managed to reduce platform errors. In addition,...

How to install Nginx and PHP on FreeBSD?

Hello, friends. FreeBSD is a secure system even more than Linux, that's why it's used as the main server. And a server has to...

How to enable local port forwarding using Ubuntu 20.04 and ssh

SSH, a very popular tool found almost with every IT guy. Commonly, when we talk about the insecure network for data, ssh is the...
x