For those of you unaware: https://nushell.sh/

This is by far the most unique shell out there, since it doesn’t use raw text as output/input to command line calls, but instead an actual data structure. It’s like if every CLI call returned a database table, in a way.

  • Colonel Panic
    link
    fedilink
    18 hours ago

    i first read “nutshell” and now i think they’ve missed an opportunity there 😅

    • @[email protected]
      link
      fedilink
      15 hours ago

      Which sounds good at first until you think of SEO. I think it has been discussed multiple times in the project.

  • @[email protected]
    link
    fedilink
    173 days ago

    I love alternative shells. my shell has been set to fish and zsh for about a year each, xonsh for a few years, and now nushell for a couple years, and I think that’s probably my ranking as well.

    fish and zsh are both nicer than bash, but they don’t give you as much as xonsh and nu do. you get nice completion and configuration and such, but it’s still a shell when it comes to the programming tasks.

    I don’t want just a shell, I want a programming language with a good repl that makes it easy to deal with commands. xonsh and nushell both do that.

    my major problem with xonsh was that there was python syntax, and there was shell syntax. it didn’t feel great to interleave sh cmds and py fns. everything had to be parsed and then everything had to be formatted to go back into sh cmds. the standard library of sh cmds doesn’t really exist either. you either use the py version of libraries for paths/processes/whatever, or you call and parse the os version. the former seems like the intended one. I found myself having to find a pip package for whatever task.

    nu solves all my problems with xonsh without sacrificing much. there isn’t really a split between nu commands and shell ones syntactically. parsing is easy, most cli things output data as lines, ascii tables, or have a json flag, and nu has nice ways to deal with all of those. nu commands generally work given a single element or a list or a full table if they make sense to. running a command on each element in a list and dealing with the output is easy as opposed to having to break your pipeline and write a for loop. they also have plenty of builtins and plugins so the things I generally want to parse are already done. ls returns a table, ps returns a table, I can pass lists into rm, etc. there’s community plugins for git so I don’t have to remember their syntax for searching for commits, I just query in nu. aws cli has a json flag so I can explore logs and such as nu data. and if I just want.

    now downsides to nu. it’s not bash so you can’t just source whatever file that a command probably gives you, and there’s no source-bash like xonsh has, so you’re stuck translating it to nu. if it just sets env vars it’s not awful since you can just shell out to bash, but doesn’t work for more complicated. for things like python you have to make sure you use the correct tool to make your venv since builtin one doesn’t give you a nu file to load. not sure about support in other tools.

    overall it’s great and not really that much learning, especially if you just use it like a shell to begin with. it’s not much commitment to try a new shell since you can still call scripts written in your previous one. I’d say try it and see how it goes

  • @Cyberflunk
    link
    63 days ago

    PowerShell is very similar to nushell, structured data output. Nushell hasn’t sold me over fish, as completions, prompts, all that is barely fledgling

  • @[email protected]
    link
    fedilink
    English
    8
    edit-2
    3 days ago

    More specifically answering your question of is it worth learning:

    It’s very interesting because it’s very different to other shells.

  • @[email protected]
    link
    fedilink
    English
    6
    edit-2
    3 days ago

    Yes, absolutely.

    I’ve been using it for a while. I’m not super/very command-line centered, but I use it as my default shell on Windows. I did not set it up as a default shell on [my] Linux servers.

    There was a bit of a time investment in making the switch, but I enjoy it a lot, and have used a few data querying and transformation functionalities that would have been much harder in other shells, requiring additional apps; I would have probably created custom C# CLI apps for them. Nushell allowed me to do those in the shell, directly, with native operations.

    I’ve also set up a few very useful aliases and commands; Like dl for yt-dlp, and dl opus for downloading highest quality opus audio. Or ff for a few ffmpeg conversions.

    I’ve also contributed a bit upstream. Maybe I’ll get more into Rust and be able to contribute more, and to the core.

    I have my setup/configuration and scripts in a public nushell-config repo.


    Examples, of how I used it productively:

    Download my paged Steam reviews because Steam doesn’t provide GDPR compliant exports, transforming the awful shitty HTML with query web into structured data, and transforming it into Markdown files for my website.

    At work; For a list of device IDs, create JSON command files, transform them into BSON via CLI call, en-mass. (We have multiple hundreds such devices. Configuration and firmware updates require mass-updates via individually addressed command files.)

    Parse and analyze DMARC reports for reported issues, and to identify report format differences from different reporters.

    I’m sure I did more things, but that’s what came to mind right now.


    Because of how much I love Nushell, I’ve created a community a little while ago, [email protected], if you’re interested.

  • fxomt
    link
    fedilink
    63 days ago

    Used to use it, but you can’t run tasks in parallel :/

    eventually switched back to fish, not enough advantages for me to use (i use nu on windows though!)

  • hallettj
    link
    fedilink
    English
    33 days ago

    I’ve been using nushell as my shell for a long while. Completions are not as polished as zsh - both the published completions for each program, and the UX for accepting completions. But you get some nice things in exchange.

    I LOVE using nushell for scripting! CLI option parsing and autocompletions are nicely built into the function syntax. You don’t have to use the shell for this: you can write standalone scripts, and I do that sometimes. But if you don’t use it as your shell you don’t get the automatic completions.

    Circling back to my first point, writing your own completions is very easy if you don’t like the options that are out there. You write a function with the same name as the program you want completions for, use the built-in completions feature, and it’s done.

  • @[email protected]
    link
    fedilink
    13 days ago

    I use it as the default shell only in my terminal (with fish completion). You still have to deal with breaking changes and inconsistency. On top of that, you need to wrap a lot of your commonly used commands and tools to take full advantage of it. But personally I consider it worth learning and using. Not only do I hate working with raw text, I also love the visual and interactive data representation. And working with existing tools is honestly not a huge problem. It’s just what you’d usually do regularly. Obviously POSIX-compliant shells in combination with many tools like jq, too are already capable of nushell’s power. But I just like to have it included in the shell language, so I can work with the data more casual.

    I couldn’t tell you why you’d use it instead of Powershell. I just never tried Powershell on Linux.

  • Aatube
    link
    fedilink
    03 days ago

    I used it as my default shell while on Windows. I think it’s still gonna be worth it on Linux, but I’m too lazy to care.