Showing posts with label Powershell on linux. Show all posts
Showing posts with label Powershell on linux. Show all posts

Thursday, April 23, 2020

Exporting command output to csv,import csv and see the content as a formatted table in powershell 7 in Debian 10

exporting command output to a csv file

get-process |  sort-object -property ws -descending | select-object -property processname,ws -first 5|Export-csv /home/sourav/Desktop/top5proc.csv


to see the content of the csv

 Get-Content ./Desktop/top5proc.csv


to impoer the csv file

import-csv ./Desktop/top5proc.csv  

if there are lots of data in the csv file we can format the output which will produce data in a more readable format

import-csv ./Desktop/top5proc.csv|Format-Table

Sunday, April 19, 2020

Install powershell on Fedora 31

# Register the Microsoft signature key
sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

# Register the Microsoft RedHat repository
curl https://packages.microsoft.com/config/rhel/7/prod.repo | sudo tee /etc/yum.repos.d/microsoft.repo

# Update the list of products
sudo dnf update

# Install a system component
sudo dnf install compat-openssl10

# Install PowerShell
sudo dnf install -y powershell

# Start PowerShell
pwsh


Source:https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7