PowerShell on Linux!?! This should be a laugh….
$ yaourt -Sy powershell-bin
Now to get started, issue the pwsh
command:
[andy@home-pc ~]$ pwsh PowerShell 6.1.1 Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/pscore6-docs Type 'help' to get help. PS /home/andy>
Cool! Looks like it worked! Lets test a couple of commands:
PS /home/andy> Get-ExecutionPolicy Unrestricted
List the processes:
PS /home/andy> Get-Process NPM(K) PM(M) WS(M) CPU(s) Id SI ProcessName ------ ----- ----- ------ -- -- ----------- 0 0.00 2.54 0.00 1065 062 (sd-pam) 0 0.00 6.48 0.42 597 597 accounts-daemon 0 0.00 0.00 0.00 388 0 acpi_thermal_pm 0 0.00 6.05 0.00 1165 165 at-spi-bus-laun 0 0.00 7.19 5.29 1176 165 at-spi2-registr 0 0.00 0.00 0.00 171 0 ata_sff 0 0.00 3.80 15.77 448 448 avahi-daemon 0 0.00 0.33 0.00 497 448 avahi-daemon ...
To list the contents of a file:
PS /home/andy> Get-Content ./.bash_profile # # ~/.bash_profile # [[ -f ~/.bashrc ]] && . ~/.bashrc PS /home/andy>
Not sure what the point is of that given that cat
works just as well!
PS /home/andy> cat .bash_profile # # ~/.bash_profile # [[ -f ~/.bashrc ]] && . ~/.bashrc PS /home/andy>
To list available Cmdlets
:
PS /home/andy> Get-Help -Category cmdlet Name Category Module Synopsis ---- -------- ------ -------- foreach Alias ForEach-Object % Alias ForEach-Object where Alias Where-Object ? Alias Where-Object clc Alias Clear-Content ... PS /home/andy>
Some commands like Get-Service
will not work as Linux daemons are very different to Windows “services”. Otherwise most things seem to work.
I hate to say it but its pretty cool! Not as cool as a Linux terminal obviously but hey! 🙂
Be the first to comment