this post was submitted on 29 May 2025
141 points (100.0% liked)

Linux

7983 readers
685 users here now

A community for everything relating to the GNU/Linux operating system

Also check out:

Original icon base courtesy of [email protected] and The GIMP

founded 2 years ago
MODERATORS
 

In the comments section of a recent post I found out that Windows PowerShell had been ported to Linux. Had no clue it was a thing.

Went looking and found this old article attempting to explain why they did it. Not remotely interested in giving up Bash for PowerShell, but I thought it was interesting enough to share. The article seems to be from 2016.

I have never been more tempted to check the NSFW box, but I'll leave it open for now unless a mod complains. :-D

top 50 comments
sorted by: hot top controversial new old
[–] [email protected] 49 points 3 weeks ago (2 children)

In short: microsoft was afraid of losing devs to linux due to an increase in linux servers.

[–] [email protected] 12 points 3 weeks ago* (last edited 3 weeks ago) (2 children)

How does this help though? If anything they would've helped themselves by porting more Linux commands to work natively in Windows. This move makes it easier for Windows admins and devs to switch to Linux. With the latest horrible moves in the Windows desktop space I can't believe they're trying to become the "RedHat of Windows".

[–] [email protected] 12 points 3 weeks ago
  • Embrace
  • Extend
  • Extinguish

It's been the Microsoft Business plan since practically the beginning.

[–] [email protected] 8 points 3 weeks ago (1 children)

If your os is windows and use ps, you can use ps on your linux vms as well. It prevents that you have to learn power and bourne. Such that it feels a bit more integrated. If you couldn't use ps, you had to use both shells which may lead to a migration to linux

[–] [email protected] 8 points 3 weeks ago

No one in there right mind uses Powershell on Linux

[–] [email protected] 4 points 3 weeks ago (1 children)

They like Linux servers since they make boatloads of money from Azure.

What they are scared of are Linux desktops and Macs. Windows is losing market share and Microsoft is to big to actual know why.

[–] [email protected] 6 points 3 weeks ago (4 children)

"Why is everyone going to linux when we are shoving copilot into fucking notepad.exe??"

load more comments (4 replies)
[–] [email protected] 45 points 3 weeks ago (30 children)

Powershell is annoyingly good though.

[–] [email protected] 32 points 3 weeks ago (4 children)

Can someone explain to me why? The outputs are objects and that is cool for scripts, but the fact that every small thing is its own cmdlet is super annoying. I can do everything in Linux if I know 10 commands. In PS I would always have to look up everything.

[–] [email protected] 28 points 3 weeks ago

the fact that every small thing is its own cmdlet is super annoying. I can do everything in Linux if I know 10 commands

That sounds more like a clash of cultures than a real problem. In Linux you need to know 10 options and possibly subcommands for each command. Naturally the same concept has different flags, and the same flag has different meanings in different commands. Is that really better?

[–] [email protected] 13 points 3 weeks ago* (last edited 3 weeks ago) (1 children)

If I recall the Verb-Noun idea is supposed to make it clear what is happening, take a look through stuff like the approved verbs for defining cmdlets. There's aliases and stuff for sure for example I think ls is an aliases for Get-ChildItem in PowerShell.

It's supposed to make it so you don't necessarily need to look things up, need to do something to an item? Well you can Copy, Remove, Rename, Move etc, and while yeah that's a super basic example that you know the equivalent linux commands for, the concept is supposed to apply everywhere. Now, whether or not people follow the guidelines is probably another story.

I don't really hate shell scripting, feel like they all have their place, complex stuff though is nicer in straight PowerShell than bash IMO, but I'm fine using either.

load more comments (1 replies)
[–] [email protected] 6 points 3 weeks ago

Maybe you're a bit more used to the linux stuff then.

https://lemm.ee/comment/20786033 -- I think powershell's syntax is far better than bash's. It feels more modern.

[–] [email protected] 4 points 3 weeks ago

Same here. I keep hearing that Powershell is so good, but I have to look up every little thing. It's all too specific and you can't remember it all.

[–] [email protected] 19 points 3 weeks ago (1 children)
[–] [email protected] 12 points 3 weeks ago (1 children)

As much as I hate windows powershell is actually decent.

[–] [email protected] 8 points 3 weeks ago (3 children)

The problem is that on Linux it competes with bash and dozens of way better terminals.

[–] [email protected] 14 points 3 weeks ago (4 children)

I've been a Linux sysadmin for decades and Windows for the year 8 years or so. I started using Windows with an air of contempt, and still do. I hate myself for saying this, but Powershell is better than bash. Bash is very limited if you consider only bash. For bash to be useful you need the entire GNU suite with grep, cut, awk etc.

[–] [email protected] 17 points 3 weeks ago

That's like saying that your car is very limited because you need cylinders, spark plugs, oil filters...

Well yeah, you do and typically that comes with the car, just like grep comes with bash

[–] [email protected] 11 points 3 weeks ago (1 children)

But that's almost never how a system is configured. The entire point is that bash, zsh, fish etc. can make use of those utilities. You don't need bash trying to reinvent everything. You don't want that. That's why changing shells is generally painless and a strength, not a weakness.

load more comments (1 replies)
[–] [email protected] 7 points 3 weeks ago

Yes, that's the point of the shell. It's the glue for all the little tools.

[–] [email protected] 6 points 3 weeks ago (1 children)

So you’re saying Powershell doesn’t uphold Unix Philosophy and thus shouldn’t be used?

[–] [email protected] 4 points 3 weeks ago (1 children)

PowerShell actually does uphold the Linux philosophy pretty well. Most functions are in modules that can be imported, disabled or swapped out as appropriate.

[–] [email protected] 4 points 3 weeks ago

PS looking good

[–] [email protected] 9 points 3 weeks ago

We're not talking terminals, though, are we? You can run pwsh in dozens of terminals. As a shell, it's... Very decent.

[–] [email protected] 3 points 3 weeks ago

I hate to say it, but powershell is better than bash.

[–] [email protected] 14 points 3 weeks ago

I'll take your word for it. I could never wrap my head around PowerShell back when I still had a Windows install. Whenever I could, I would use either the DOS prompt or WSL/Ubuntu. I may not be great at Bash or DOS but at least I'm not having to resort to cargo culting to do anything. Probably a sign I'm getting old.

[–] [email protected] 13 points 3 weeks ago (2 children)

there are other shells that have all the nice powershell things without the weird stuff (at least for not windows people), like nushell

although I wouldn't be surprised if powershell was the thing that started the trend of better shells

[–] [email protected] 2 points 3 weeks ago (2 children)

Random question for everyone from a bit of a noob. When I'm using Powershell (PS) in windows I can start to type the name of a built in command or one I have added to PATH and then press tab to auto complete the command. That part works the same in my Linux terminal.

What I can also do after I have typed that command into PS is start to type a file name that exists in the directory that PS is working in and then press tab to auto complete or cycle through the files that match and it even formats the name of the file correctly (meaning if it has a space in the name it will wrap the name in quotes so that it is understood by the commands they are fed to). This auto completing of file names even works on files that were created after the PS window was opened. This functionality doesn't seem to exist by default in any distro I have used. Is it possible to do this in the Linux terminal?

Although I have done some distro hopping, most of them have ultimately been Ubuntu based. Currently running Kubuntu.

[–] [email protected] 6 points 3 weeks ago

By default Bash will auto complete filenames (In fact, in 25 years, i can't remember the time bash didn't). Sometimes, there are autocomplete 'helpers' that try to be overly smart (ie, only autocompleting files that have the right extension, which can interfere when you are doing creative things with mis-named file). However, in Powershell, cmdlets declare a type for each of their parameters, which lets powershell autocomplete the right type of item, which can make it a bit more magical and reliable.

[–] [email protected] 3 points 3 weeks ago

I mean, I'm not a big fan of bash, the most likely default shell, so my advice would be to explore some alternate shells.

I am a little surprised completions aren't working in bash by default, but yeah idk if it's possible to get the cycling through suggestions. double tap tab and it should at least list the options though.

I'd recommend you hop between some shells and see what you like. most distros tend to keep the default shell pretty vanilla, the most change you'll get is maybe zsh with some nicer defauls.

nushell is great and would be my first recommendation. everything is structured like powershell, but way less verbose and more emphasis on integrating the existing cli ecosystem than pwsh's commandlets for everything.

fish or oh-my-zsh are things other people recommend. you don't get structured data but they do give a better completion experience and other nice things

I want to like xonsh, and used it for a few years, but it has the same problems pwsh has with separate ecosystems of structured commands and unstructured text. if you're a python person though I'd consider it too though.

load more comments (1 replies)
[–] [email protected] 2 points 3 weeks ago (2 children)

No grep though as far as I could find... There was a similar cmdlet IIRC, but it was extremely limited and didn't work well (this was years ago though)

[–] [email protected] 9 points 3 weeks ago (2 children)

The idea with powershell isn't to be a text parser - so grep doesn't really work. When you pass things through pipes, it's a full object with multiple properties, and those you can filter with either simple expressions like select-object [-property] or with more complex expressions: https://4sysops.com/archives/add-a-calculated-property-with-select-object-in-powershell/

load more comments (2 replies)
load more comments (1 replies)
load more comments (25 replies)
[–] [email protected] 11 points 3 weeks ago (1 children)

Long ago I tried a cygwin based openssh server in Windows. Permissions were a real issue.

load more comments (1 replies)
[–] [email protected] 9 points 3 weeks ago

All I remember is the years of M$ using lawsuits and FOSS to try and kill Linux. Using anything from Windoze is like saying, yeah, but the Nazi built some good stuff too. M$ tried to murder our baby, and should never be forgiven nor trusted.

[–] [email protected] 6 points 3 weeks ago

I work on both Linux and windows machines for some software projects. It's nice to be able to write powershell helper scripts and have it work on both.

load more comments
view more: next ›