Anyone use powershell on linux?
from Euphoma@lemmy.ml to linux@lemmy.ml on 04 Aug 17:28
https://lemmy.ml/post/34158136

Or any other alternate shells that aren’t bash?

#linux

threaded - newest

DichotoDeezNutz@lemmy.world on 04 Aug 17:37 next collapse

Nope, I’ve tried it before but I prefer the muscle memory of bash/zsh.

I’ll use it on Windows though.

eldavi@lemmy.ml on 04 Aug 17:41 next collapse

i ws forced to do it recently and noticed that they enforce usage of black terminal, like it is in the command prompt in windows.

it was a pain in the ass to keep switch colors just to touch that one powershell module and my first priority to replacing with with a python equivalent. they still think that the powershell module is being used, but it’s no longer capable of working in this environment and they’re going to have to spend $$$ to make it useable because i forsee LOT of difficulty and delays in bringing it up to spec.

just_another_person@lemmy.world on 04 Aug 17:59 next collapse

Honest question: why?

Euphoma@lemmy.ml on 04 Aug 18:14 next collapse

Why not? It seems like a well supported shell on windows that isn’t terrible.

Mordikan@kbin.earth on 04 Aug 18:38 next collapse

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.

nfms@lemmy.ml on 04 Aug 19:11 next collapse

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

LeFantome@programming.dev on 04 Aug 19:43 next collapse

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.

Uebercomplicated@lemmy.ml on 06 Aug 03:33 collapse

For a long time I used a super customized zsh setup. It was, unfortunately, crazy slow and regularly broke on updates. It had precisely all the features and behavior I wanted though. Like you say, zsh is very customizable.

Then I switched to tiling window managers and with that to the alacritty terminal. This made me value start up times and performance, as I was constantly opening and closing terminals. So I spent a ridiculous amount of time optimizing my zsh config to be as fast as possible. This is also what I used for a long time before correcting my ways.

When that device, my work laptop, failed, I had to set up my desktop for work. This involved setting up zsh, which I quickly realized was a lot of work. So, on a whim, I installed fish.

Oh my god. Not only did fish have nearly all the features I wanted out of the box, but it was easy to add plugins (customizations) in a performant way. Fish even had default behavior I didn’t know I needed. And most importantly: it was crazy fast!

Since then I have never left fish. It is so much better than anything I had imagined. At this point I use way more default features as well, so I pretty much only add the tide prompt and zoxide. I also have a functions and abbreviations folder which is essentially my zsh alias collection.

The crazy part is really how much faster it is though. I really, really love it. And now they’re rewriting it in Rust as well!

nymnympseudonym@lemmy.world on 04 Aug 18:58 collapse

bash is also well supported in Windows via WSL

johannes@lemmy.jhjacobs.nl on 04 Aug 18:37 next collapse

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” :)

Badabinski@kbin.earth on 05 Aug 12:55 next collapse

Powershell is a better language but is absolutely dogshit for interactive use IME. It's SO wordy and the excessive use of camelCase is annoying and I yearn for simple GNU coreutils every time I touch it. Like, give me tail -f please, why does cat also have a -Wait option or whatever the fuck

trey_a_12@lemmy.world on 05 Aug 15:24 collapse

Understandable sentiments. I’m a MS Edge user, for instance, and despite slowly switching almost all my other services, MS Edge just gets it all right. Brave’s featureset is basically a lesser version, and Firefox is getting better, but Microsoft (of all companies) genuinely made a great browser.

mortalic@lemmy.world on 04 Aug 18:57 next collapse

Development. Azure especially.

gray@pawb.social on 04 Aug 21:02 collapse

There’s an AZ CLI for every PS Azure module though.

mortalic@lemmy.world on 05 Aug 04:47 collapse

There are reasons for the SDK and reasons for the CLI. Both have their place.

JackbyDev@programming.dev on 04 Aug 18:58 next collapse

Why do you care why OP asks if people use something?

just_another_person@lemmy.world on 04 Aug 19:46 collapse

I mean what’s the practical purpose?

Fizz@lemmy.nz on 04 Aug 20:05 next collapse

PS is much nicer to write scripts. It has QoL

just_another_person@lemmy.world on 04 Aug 20:12 collapse

Uhhhh…no? It has zero integration on Linux, which is why I asked.

Auth@lemmy.world on 04 Aug 21:46 collapse

zero intergration? Thats just wrong. I’d argue you can do anything with PS on linux that you can with bash.

just_another_person@lemmy.world on 04 Aug 22:30 collapse

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.

bravemonkey@lemmy.ca on 04 Aug 23:14 collapse

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.

JackbyDev@programming.dev on 05 Aug 01:31 collapse

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?

just_another_person@lemmy.world on 05 Aug 02:23 collapse

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.

JackbyDev@programming.dev on 05 Aug 05:54 collapse

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.

lightnsfw@reddthat.com on 04 Aug 20:53 next collapse

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.

DasFaultier@sh.itjust.works on 04 Aug 21:33 next collapse

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.

just_another_person@lemmy.world on 04 Aug 22:26 collapse

vSphere has SSH access. This isn’t a reason to use PSH on Linux.

DasFaultier@sh.itjust.works on 05 Aug 19:33 collapse

It’s been a while for me and i can’t try things out atm, but i think vSphere SSH access is only for managing the appliance itself, not objects like VMs in a vSphere cluster. For that, you would have to use the Python SDK or PowerCLI.

signofzeta@lemmygrad.ml on 05 Aug 02:30 next collapse

Because I never learned Bash scripting, for whatever reason, and WSL wasn’t yet available to load on my work PC at the time.

ashley@lemmy.ca on 05 Aug 03:05 next collapse

exchange online shell

jollyrogue@lemmy.ml on 05 Aug 05:12 collapse

Because I have to admin Windows boxes and M365. There are PS modules for lots of different MS things.

hades@feddit.uk on 04 Aug 18:16 next collapse

Does zsh count?

chrash0@lemmy.world on 04 Aug 18:37 next collapse

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 and ls 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 into nushell query with a unified DSL using common syntax like select and where.

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 medium

RoadTrain@lemdro.id on 04 Aug 21:58 next collapse

Hi! 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?

  1. How easy was it to get started?
  2. 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?
  3. Can you integrate it with existing tools that you know how to use from other shells, like grep or awk?
chrash0@lemmy.world on 04 Aug 22:34 collapse

sure!

  1. 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 to nushell like working with tables.
  2. 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.
  3. it works out of the box with your existing PATH (or Path 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: 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 shell

RoadTrain@lemdro.id on 04 Aug 23:06 collapse

Thanks a lot! This might just be enough to get me to actually try it!

flying_sheep@lemmy.ml on 05 Aug 14:40 next collapse

Finally! Nushell is awesome. The infrequent deprecations are a bit annoying, but I prefer them to having a bad program go 1.0

zarkanian@sh.itjust.works on 05 Aug 23:21 collapse

cat and ls have canonical short names to save disk space on the systems they were created for.

I thought it was to save on keystrokes due to slow transmission speeds.

chrash0@lemmy.world on 06 Aug 00:01 collapse

yeah overall bandwidth was probably a consideration

jaypg@lemmy.jaypg.pw on 04 Aug 18:40 next collapse

It’s not my default shell on most of my servers but I use it all the time. I’m just not a fan of treating everything as a stream of text to grep, trim and sort into structured data that’s easier to work with. Plus, cross platform. I’ve tried nushell a bit but I always go back to PowerShell.

tetris11@lemmy.ml on 04 Aug 18:45 next collapse

i just wish bash had structured data and basic types, that’s it

JackbyDev@programming.dev on 04 Aug 18:57 next collapse

I use zsh on my work computers and fish on my desktop. Zsh is still POSIX compatible so is more bash-like. Fish is nice. When I use bash or zsh I want to use oh-my-zsh but with fish I haven’t found myself wanting anything extra like that.

dil@lemmy.zip on 04 Aug 19:05 next collapse

Fish is the cachyos default, I used oh my zsh too, I honestly cant tell a difference as a non dev end user

dil@lemmy.zip on 04 Aug 19:06 next collapse

I like autocompetion/suggestions

gaylord_fartmaster@lemmy.world on 04 Aug 21:59 collapse

I tried fish before switching to zsh because it has much better compatibility with bash, and I think bash/zsh handles a lot of things like aliases way better. I’m also on CachyOS and the default zsh config with ohmyzsh and powerline10k it comes with is great.

cupcakezealot@piefed.blahaj.zone on 04 Aug 19:52 next collapse

zsh and oh-my-zsh :)

morethanevil@lemmy.fedifriends.social on 04 Aug 22:49 collapse

Same here, just started a few days ago with both and Atuin for history across devices (server can be selfhosted easily)

exu@feditown.com on 04 Aug 19:53 next collapse

I use fish, but only interactively. Scripts are either in bash or Python depending om what I need.

mugita_sokiovt@discuss.online on 04 Aug 20:28 next collapse

My producer and I personally use Bash. We tried zsh, but that didn’t treat us very well. Fish is actually pretty nice, though.

Mwa@thelemmy.club on 04 Aug 20:38 next collapse

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)

lightnsfw@reddthat.com on 04 Aug 20:49 next collapse

I didn’t know powershell was an option on Linux.

corsicanguppy@lemmy.ca on 04 Aug 21:07 collapse

It’s an option. Every other option is better, but it’s a brochure entry; and an option.

chris@l.roofo.cc on 04 Aug 20:54 next collapse

I have used powershell on windows and Linux and I really like that the data that is moved through a pipe is encapsulated in objects. But in the end I stuck with zsh.

Dremor@lemmy.world on 04 Aug 21:14 collapse

I think you have a surplus apostrophe somewhere… 😏

TechAngel@lemmy.world on 04 Aug 21:16 next collapse

I use fish, mostly because it is the default on CachyOS

Cat_Daddy@hexbear.net on 04 Aug 21:19 next collapse

nushell is pretty cool

mohab@piefed.social on 04 Aug 22:23 next collapse

I use Linux to get away from PowerShell 😂 I did try zsh though, it was nice, maybe give it a shot.

lordnikon@lemmy.world on 04 Aug 22:27 next collapse

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.

data1701d@startrek.website on 05 Aug 01:22 next collapse

No.

I usually just use Bash; there’s a certain level of complexity where it begins to be more reasonable to just use Python.

gonzo-rand19@moist.catsweat.com on 05 Aug 01:26 next collapse

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.

non_burglar@lemmy.world on 05 Aug 01:55 next collapse

I do, but only for work. There are certain tasks you can’t do easily with just api calls.

Tapionpoika@lemmy.ml on 05 Aug 02:11 next collapse

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?

stiltonfondu@sh.itjust.works on 05 Aug 03:36 next collapse

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

nimpnin@sopuli.xyz on 05 Aug 06:41 next collapse

I use fish

Electricd@lemmybefree.net on 05 Aug 06:47 collapse

<img alt="" src="https://c.tenor.com/qXMZnbzTdGIAAAAC/fish-omg.gif">

sxan@midwest.social on 05 Aug 18:11 collapse

Not that kind of “use!”

Sina@beehaw.org on 05 Aug 07:47 next collapse

Basically no one is using powershell on Linux. zsh is popular and i’m using fish.

beeng@discuss.tchncs.de on 05 Aug 07:55 next collapse

At work we use it sometimes on Linux because we maintain a script that needs to work on multiple platforms, ps1 did that in this usecase better.

Came down to ps1 on Linux was better and more predictable than bash on windows.

Sadly.

Frederic@beehaw.org on 05 Aug 11:31 collapse

Same, only time we used it is when we needed a script that was running in Windows and Linux, easier to maintain one script that 2 in 2 languages

Doorknob@lemmy.world on 05 Aug 08:43 next collapse

I tried to use it for admin in a Windows environment, but half the modules I needed wouldn’t work in Linux which made it pretty much useless.

Heavybell@lemmy.world on 05 Aug 08:45 next collapse

I use it for some things. It’s good for file batch processing, for example. I could probably do those things in python but I use C# and powershell at work so I know .net better.

surrealpartisan@lemmy.world on 05 Aug 09:27 next collapse

I use xonsh.

disco@lemdro.id on 05 Aug 10:12 next collapse

What’s wrong with bash? Something missing or not to your liking? It can be configured

Euphoma@lemmy.ml on 05 Aug 13:05 next collapse

Manipulating data in bash is bad.

martinb@lemmy.sdf.org on 05 Aug 15:00 collapse

Base 64 encode all your array variables then decode them when needed

Euphoma@lemmy.ml on 05 Aug 16:21 collapse

Real

flying_sheep@lemmy.ml on 05 Aug 14:38 next collapse

It has atrocious error handling, and there’s no reasons why arrays should only be 1D.

zarkanian@sh.itjust.works on 05 Aug 23:15 collapse

Maybe it can, but with fish, it does what I want right out of the box, and I don’t have to spend time configuring it.

Andrzej3K@hexbear.net on 05 Aug 10:21 next collapse

Zsh is nice, particularly with a couple of plugins

mactan@lemmy.ml on 05 Aug 13:01 next collapse

only for extraordinarily cursed situations where games need it in wine/proton

somerandomperson@lemmy.dbzer0.com on 05 Aug 13:47 next collapse

I use both fish and zsh

somehow

sxan@midwest.social on 05 Aug 18:10 collapse

That’s… a big gap. I think I’d just be confused all the time if I had to switch between them.

somerandomperson@lemmy.dbzer0.com on 05 Aug 18:16 collapse

I mean, missing commands say that it’s zsh but everything else says that it’s fish.

ArsonButCute@lemmy.dbzer0.com on 05 Aug 14:59 next collapse

I used to use fish but I’m learning Unix right now and am trying to use only defaults so I can learn freebsd the way it exists on a dvd, so right now I’ve been using the Bourne shell

LeFantome@programming.dev on 06 Aug 03:00 collapse

If you are using FreeBSD, you are probably using the Almquist Shell.

en.m.wikipedia.org/wiki/Almquist_shell

BSD has not used Bourne since the 90’s. Bash is of course the “Bourne Again Shell”.

For Linux fans, “dash” is the (Debian Almquist Shell). It is the Linux version of the BSD shell. Dash is the default /usr/bin/sh in Debian and Ubuntu I think. So, pretty close to the same shell as FreeBSD.

ArsonButCute@lemmy.dbzer0.com on 06 Aug 03:01 collapse

That’s the one!

SO much of the documentation I’ve seen refers to the Bourne shell I just assumed thats what I was using!

jodanlime@midwest.social on 05 Aug 14:59 next collapse

Only when I’m doing MS shit for work. Otherwise I find it kind of a pain. I get that some of it’s ideas are nice, but functionally it doesn’t actually do anything for me on unixy systems that bash doesn’t so I don’t. I’m not going to install it on all my servers so using it for scripting doesn’t make sense and I do more Linux admin than MS.

hobbsc@lemmy.sdf.org on 05 Aug 15:52 next collapse

only when dealing with azure for work. otherwise bash/python work just fine and have for me for the last 30 odd years.

iamdefinitelyoverthirteen@lemmy.world on 05 Aug 16:30 next collapse

At work I use powershell to ssh into Linux boxes fairly regularly.

ziviz@lemmy.sdf.org on 06 Aug 00:11 next collapse

I use powershell for some scripting. I’ve been using .net/powershell forever and I know it better than python. If bash can’t handle it in a few lines, and I don’t have to use python, I’ll go powershell.

golden_zealot@lemmy.ml on 06 Aug 01:42 next collapse

I’ve used powershell in previous jobs and if you learn it really well I cannot deny it is super powerful.

For a college project, a friend of mine somehow made a hexadecimal file dumper with it, with formatting and everything (think like what you would see in wireshark) in one, reasonably long, line of powershell.

However I’m just not a big fan of it personally for syntactical reasons (even with the syntax being super logical) and much prefer bash, or other unix-like native shells. I’ve been thinking about taking zsh for a spin recently to see what it’s like.

transebding_the_binary@lemmy.blahaj.zone on 10 Aug 07:11 collapse

I use fish via konsole however I still use bash as my login shell for stability reasons.