Or any other alternate shells that aren’t bash?
I use fish
I use PowerShell on Linux for work stuff. We maintain a set of Azure deployment scripts that were originally developed on PS 4 and 5 for Classic Azure. They’ve been migrated to AzureRM and now PS Core and Az. The scripts are now fully cross-platform.
We even use some PS remoting over SSH for remotely deploying stuff on Linux VMs where we run some bash commands for configuration.
I started with bash scripting years ago and never really used PS for Windows or exchange server admin. Just in the last decade for Azure stuff.
Sounds weird and horrible but it’s fine.
Bash is still home
The idea of someone using powershell when you are on Linux is a form of self harm and you need to reach out as its clearly a cry for help.
It is not always Bash. Zsh comes as a default with some Arch based distros like Manjaro (xfce) and Garuda, plus Kali of course. But what is the point to use PowerShell in Linux? … Azure, Exchange or Windows servers or something else I don’t get?
I use fish, I had to learn some new syntax and modify some functions since it’s not POSIX-compliant, but it was pretty painless.
No.
I usually just use Bash; there’s a certain level of complexity where it begins to be more reasonable to just use Python.
I do, but only for work. There are certain tasks you can’t do easily with just api calls.
I use Linux to get away from PowerShell 😂 I did try zsh though, it was nice, maybe give it a shot.
zsh and oh-my-zsh :)
Same here, just started a few days ago with both and Atuin for history across devices (server can be selfhosted easily)
Honest question: why?
Because I have to admin Windows boxes and M365. There are PS modules for lots of different MS things.
exchange online shell
Because, as someone who dislikes MS as much as possible, Powershell is one of the few things they done right :) And when you manage mostly Windows servers and a few Linux servers, why not choose a solution that works on both platforms? And yes, perl, python, ruby, they all work on Windows too, but its just not comparable to powershell on Windows.
So i can understand why someone asks this question :)
Personally, i keep them both seperated, powershell on Windows, bash on Linux. But i can understand why someone might choose to go “powershell all the way” :)
Why not? It seems like a well supported shell on windows that isn’t terrible.
It seems like a well supported shell on windows
But you aren’t using Windows. You’re also now adding a .NET Core requirement for any Linux box wanting to use it. That means limited functionality as its not the full blown .NET framework. So, compared to something like bash, you now have added requirements with less functionality.
To answer your original question though, a lot of people prefer zsh as its got a crazy amount of customization you can do. People also like fish due to it being very friendly and interactive.
limited functionality as it’s not the full blown .NET
This is misleading to the point of being completely wrong
On Linux, you do not have access to Windows UI frameworks like WinForms, the Windows registry, and to System.Drawimg (because it is just a thin wrapper over Win32). Essentially the entire .NET standard library is available on Linux.
I would argue that .NET is actually better on Linux for some things (like web dev).
That said, I can see no reason to use PowerShell on Linux unless you are a .NET dev.
There are PowerShell cmdlets that do not work on Linux. Again, mostly stuff that talks to explicitly Windows services and sub-systems. But that has nothing to do with .NET at all. Also, path separators and case sensitivity is different on Linux. So, cross-platform scripting is a pain.
I’ve once created a profile with about 1500 lines of code for powershell, managing AD at work. It was great to learn, it’s great for scripting and it’s very intuitive (for me at least), I also liked working with objects.
I wouldn’t use it on Linux though, I’m not sure how well integrated it is.
I’m using fish at the moment, desktop and server, and I like it primarily for the functions and the autocomplete
bash is also well supported in Windows via WSL
I didn’t know you could use it on Linux. I’d consider it because I’ve used it at work for years and my experience with bash is far more limited. Powershell is pretty damn intuitive. I’ve gotten a lot further with it than I have any other scripting language.
Development. Azure especially.
There’s an AZ CLI for every PS Azure module though.
There are reasons for the SDK and reasons for the CLI. Both have their place.
If you run VMware, you can use PowerCLI to interact with your vSphere servers, and PowerCLI requires PowerShell and uses similar syntax. I haven’t tried it on Linux yet, but I would assume that that might be a valid use case.
vSphere has SSH access. This isn’t a reason to use PSH on Linux.
Why do you care why OP asks if people use something?
I mean what’s the practical purpose?
The practical purpose of asking is to get a feel for how many people use it.
Less tongue in cheek though, it sounds like you have the same questions as OP. If you’re curious what might be the practical purpose, why not ask people who use it why they do instead of berating OP for asking if anyone uses it?
Well by that logic, it’s a way for Windows users to not learn the native tooling available, but not skip any steps. It doesn’t make any sense.
Learning Powershell in a Linux environment is going to just absolutely be a crutch and fuck up your ability to interact with other Linux systems that don’t share your particular environment.
As someone who used bash on Windows through MSYS, I don’t see the issue. It was different, not inferior, to cmd and PowerShell. If someone wants to use PowerShell on Linux why be such a condescending jerk about it? Sometimes people just wanna try things for the fun of trying new things.
PS is much nicer to write scripts. It has QoL
Uhhhh…no? It has zero integration on Linux, which is why I asked.
zero intergration? Thats just wrong. I’d argue you can do anything with PS on linux that you can with bash.
Perfect example:
Bash:
sudo dnf install python
OR
PS: `Invoke-Expression ‘sudo dnf install package-name’
Stupid to even try and make the argument that PS is a viable solution to anything at all with its ignorant declarations of obvious usage.
With PowerShell on Linux you’d never run dnf starting with Invoke-Expression. It’s completely unnecessary.
This feels like you either legitimately don’t know how it works so are assuming, or are making it more complicated on purpose to make bash look ‘better’.
I’m not saying PowerShell should be used on Linux over bash, but your example is not a good one.
i’m a big
nushell
fan.i was once sitting where you are. when PowerShell was released on Linux i thought about switching and read the manual. i really liked some of the philosophy:
- descriptive names for commands.
cat
andls
have canonical short names to save disk space on the systems they were created for. this is no longer a constraint and aliasing a longer command name is better than “git gud n00b” when it comes to discoverability. - structured data. “everything is a string” is great when programs play nice. it breaks apart when programs prefer human readable output or worse don’t provide structured output, like
—format=json
or whatever. - modern control flow semantics. yes, pipes are great, let’s keep those, but why do i have to rtfm every time i want to bang out a simple script with an if-else control flow?
i looked around at a few solutions.
xonsh
uses Python.eshell
is integrated into emacs and uses Elisp. i briefly tried to hack something together using Kotlin Script. and yeah, i tried PowerShell.i settled on
nushell
not just because it fulfilled the above requirements, but also:- simple data types. string, number, list, record, and table are about the only types you deal with.
- wide support for structured data. JSON, YAML, TOML, CSV, etc have parsers built in.
jq
and other such tools are made irrelevant because you just load it intonushell
query with a unified DSL using common syntax likeselect
andwhere
.
honestly, these are the killer features. there are so many more. context aware autocomplete, modules and overlays, super easy custom completions, extension functions (one of my favorites is
git remote open
), cross platform (if you’re forced to use Windows), plugins, and i can contribute since i do Rust development for work.give PowerShell a shot, but i think
nushell
is the happy mediumHi! I’m interested in trying Nushell at some point, although I keep putting it off…
Would you share your experience on a couple of items?
- How easy was it to get started?
- Do you find, or did you at least find in the beginning, that it is more suited for some particular tasks than using it as your day-to-day shell? If so, what were those?
- Can you integrate it with existing tools that you know how to use from other shells, like
grep
orawk
?
sure!
- it wasn’t tough to get started. it generally reads like a normal Unix shell with some exceptions. i don’t think many Linux power users would have a hard time doing basic file system tasks or launching programs, etc. there are going to be some issues, like you can’t just paste
bash
commands in because&&
isn’t supported, multiline strings don’t require the\
character, and string escaping is totally different. those are intentional deviations that i personally agree with, but they take some getting used to. and then obviously stuff that is specific tonushell
like working with tables. - definitely the killer feature out of the box is manipulating, parsing, and reading structured data. the “aha” moment for me was when i needed to change a value over a thousand or so JSON objects and did it with a one liner. then i use it with some extra overlays to do stuff like connect to a k8s cluster like
k8s connect (helm stage dev.0)
which reads my YAML config and connects to the cluster specified in that file. or making a call to our internal package store to get the latest version by parsing the returned JSON. - it works out of the box with your existing
PATH
(orPath
if you’re nasty). you can just drop into it and it will have all the path stuff inherited just like if you launched zsh or bash. you’ll have to set that up if you want to use it as a system shell—like i do—, but otherwise it’s pretty seemless.
you can check out my collection of scripts here: https://github.com/covercash2/dotfiles/tree/main/nuenv
ETA: if you do have compatibility problems or need your old muscle memory to do something quick, it’s easy enough to use
bash -c old_script.sh
or just drop into a different shellThanks a lot! This might just be enough to get me to actually try it!
- it wasn’t tough to get started. it generally reads like a normal Unix shell with some exceptions. i don’t think many Linux power users would have a hard time doing basic file system tasks or launching programs, etc. there are going to be some issues, like you can’t just paste
- descriptive names for commands.
I use fish, but only interactively. Scripts are either in bash or Python depending om what I need.
I use fish, mostly because it is the default on CachyOS
I didn’t know powershell was an option on Linux.
It’s an option. Every other option is better, but it’s a brochure entry; and an option.
I dont use powershell.
I use ZSH on My Gaming PC cause its POSIX and and has autocorrect and auto complete also with CachyOS They replicate fish features.
I use the Default good’ol bash on my Laptop running Debian that’s on Life support because I dont care.
I tried Fish but didnt like the no POSIX compliance(ik they wanna fix POSIX but its annoying)