A tour around nushell - a modern replacement for zsh and bash based on structured data

Поделиться
HTML-код
  • Опубликовано: 27 июл 2024
  • Did you ever notice how little has changed in how we interact with a terminal? Sure, zsh is nicer than sh, tmux is useful - but working in a terminal is still extremely based on text, strange mnemonics etc. ChatGPT helps with all that, but wouldn't it be nice if we could have a shell that is built around modern ideas, not only the same stuff as in the 70ies?
    This is what nushell is (nushell.sh) - it is written in rust, taking some inspiration from powershell but packaging it all in a really ergonomic package.
    Commands consume and output structured data (through wrappers around the most common linux command or parsing/serialization helpers for the rest). This then lets you learn how to sort or filter data once and use it for all sorts of programs.
    In this video I give a brief tour of nushell, how it works and some ideas for you can do with it.
    Chapters
    0:00 Intro
    0:58 What would we like in a shell?
    2:10 Starting nushell and a first taste - ls
    4:25 Outputting to different structured formats
    5:44 Inspecting structured data - sys
    7:40 Building more complex pipes with each
    11:00 Working with sqlite databases
    13:50 Http requests from nushell
    14:50 Parsing text into structured form
    15:40 The built in help
    16:10 Query web to query into html
    16:36 Working with common programs that output only text like git
    21:12 Getting structured output from docker
    23:50 Installing nushell
    25:10 Dataframe support for parquet files
  • НаукаНаука

Комментарии • 74

  • @JeremySeago
    @JeremySeago 10 месяцев назад +82

    Demonstrating a shell through VS Code was triggering 😅

    • @DanielBachler
      @DanielBachler  10 месяцев назад +16

      😂 - I recorded this video for my co-workers and the fact that Vs code has a decent terminal and is cross platform is useful for us :)

    • @Mugruokgt
      @Mugruokgt 6 месяцев назад +1

      Really it was…. 😂

    • @pierrebertram5555
      @pierrebertram5555 Месяц назад

      Interesting

    • @samucancld
      @samucancld Месяц назад

      Disgusting

  • @howardjones543
    @howardjones543 Год назад +12

    This looks really nice! It's interesting that a lot of this has been in powershell for a really long time.

    • @howardjones543
      @howardjones543 Год назад +2

      But wait, it also actually takes OUT options you already know. No "ls -ltr" for you anymore! "ls | sort-by modified" and no completion on that "modified" either. Definitely curious enough to play for a few days though.

    • @MarcelRiegler
      @MarcelRiegler Год назад +13

      @@howardjones543 Yes, but on the other hand you learn once how to sort-by and can then sort all output of any command without finding out how that specific command does it.

  • @odytrice
    @odytrice 11 месяцев назад +11

    OMG, This is awesome, I love how the columns are repeated on both sides of the table. This feels like what bash or zsh would look like if they were written in our modern era. Thanks Daniel

    • @DanielBachler
      @DanielBachler  11 месяцев назад +2

      Hey Ody! Really nice to see that you like it too :). Let's catch up some time!

    • @odytrice
      @odytrice 11 месяцев назад

      @@DanielBachlerYeah absolutely

  • @yos2413
    @yos2413 6 месяцев назад +1

    Wow 7 months and I didn't know about that awesome vscode terminal feature, thanks, and thanks for the tip and for the video overall!

  • @Cammymoop
    @Cammymoop 11 месяцев назад +3

    This was way more interesting than i thought it would be

  • @Diamonddrake
    @Diamonddrake 8 месяцев назад +10

    Power shell does things very similarly, structured data objects with filtering and conversions and formatted output and some 4000 cross platform built in modules and everyone seems to hate it. This looks nice though. Really like that you can tell it how to parse things it doesn’t natively understand

    • @DanielBachler
      @DanielBachler  8 месяцев назад +4

      Yeah - Powershell had great ideas but the verbosity etc was not ideal. I think nushell really hits a sweet spot here.

    • @cokoala5137
      @cokoala5137 6 месяцев назад +4

      A lot of the inspiration for nushell comes from powershell. The dev that created nushell used to work at Microsoft for a couple of decades

    • @TiagoJoaoSilva
      @TiagoJoaoSilva 16 дней назад

      @@DanielBachler The verbosity is only recommended in scripts, so you can understand them next year when you need to update something. On the cli there are aliases, auto-complete, Ctrl-Space, and switches/parameters only need disambiguation (eg, no need to write '-Parameters', most of the time -Par is enough to disambiguate from -Path)

  • @danieleden1856
    @danieleden1856 Год назад +3

    Great demo ! Very powerful shell, esp for people who like to manipulate data quickly at the shell

  • @polimetakrylanmetylu2483
    @polimetakrylanmetylu2483 8 месяцев назад +3

    Nushell saved me 10 minutes of formatting an ugly JSON file by hand by instead composing a chain of commands to do what I want. It took me a few hours, I was just starting using it, but being able to work with files in this way was so satisfying and definitely much nicer than Python!

    • @peppybocan
      @peppybocan 8 месяцев назад +2

      or just learn to use jq.

  • @rb.x
    @rb.x Год назад +8

    Thanks for this! Just installed nushell on a recommendation and was wondering what I could do with it… looks like things have changed over the past couple of years so was glad to find your walkthrough. I’m excited!

  • @lancemarchetti8673
    @lancemarchetti8673 11 месяцев назад +1

    Really cool work!

  • @MatthewSherborne
    @MatthewSherborne 4 месяца назад +3

    `take 1 | transpose` == `first`

    • @DanielBachler
      @DanielBachler  4 месяца назад +2

      Good catch :) - when I recorded this video I wasn't so aware yet of all the useful functions. Thanks for signposting it so others can find it!

  • @michael-rommel
    @michael-rommel Год назад +2

    You made me try rhis out... Thanks!!

  • @mineralisk
    @mineralisk 5 месяцев назад +1

    nutshell sounds like if a Linux shell and PowerShell had a baby

  • @bripbrap
    @bripbrap 9 месяцев назад +2

    Its like a good Powershell

  • @somedude5990
    @somedude5990 11 месяцев назад +2

    Looks interesting. Hope it gets popular so I can use it.

    • @Argletrough
      @Argletrough 11 месяцев назад +1

      Why would it have to be popular for you to use it?

  • @wondays654
    @wondays654 Год назад +2

    Been using nutshell for the past 5-6 months. I don’t think I’ll be going back.

  • @filipeacaciooficial
    @filipeacaciooficial 3 месяца назад

    Great video!... What plugins are you using (Especially the one that lets you display details of the git repository)?

    • @DanielBachler
      @DanielBachler  3 месяца назад

      IIRC the only plugin I used was the query plugin (github.com/nushell/nushell/tree/main/crates/nu_plugin_query). The git stuff wasn't using any plugin but instead used the jc standalone utility (github.com/kellyjonbrazil/jc). Hope that helps!

  • @QashbasJupiter
    @QashbasJupiter 2 месяца назад

    The wishes are sundunopulated

  • @TooManyPBJs
    @TooManyPBJs 8 месяцев назад +2

    the ls reminded me of a pandas dataframe

    • @DanielBachler
      @DanielBachler  8 месяцев назад

      Yeah that is exactly right - it actually uses a dataframe library internally :)

  • @garciajero
    @garciajero Год назад +4

    what problem would this be fixing ? i can't stop shivering at all those borders messing up every grep and xclip

    • @DanielBachler
      @DanielBachler  Год назад +5

      Well the whole point is that you don't work on the textual level most of the time, so the borders you see are just generated when printing the results to the screen. Imagine you have a csv with a bunch of numeric columns and you want to select the rows that have a value between 0.4 and 0.6 in column A. This is really easy in Nushell because you open the csv file and then you just filter by parsed values. It can be done with traditional shell tools but it's quite more cumbersome in many cases.
      If all you ever need to do is to grep for precise text then yes, Nushell doesn't make that particular use case much easier; but it combines a lot better between different, hetherogeneous operaions.

    • @garciajero
      @garciajero Год назад

      @@DanielBachler that’s doable in any shell awk first one that comes to mind

    • @only2sea
      @only2sea Год назад +5

      @@garciajero You can do command | to tsv to make the output tsv without borders. It doesn't fix a problem, in my opinion, but it makes dealing with data easier by default, while you'd need additional | to tsv if you want the output useful for computers instead of human eyes.

    • @garciajero
      @garciajero Год назад

      @@only2sea Im not really complaining about the borders much , i think it fixes a problem that nobody has this shell thing

    • @heyitsdross
      @heyitsdross 11 месяцев назад +5

      @@garciajero Awk has a high learning curve, with it being similar to a programming language on its own. Any shell that removes the need for such learning is worth looking into, in my opinion.

  • @sullivan3503
    @sullivan3503 11 месяцев назад +3

    It's almost like separating shell languages from "proper" programming languages was a huge mistake.

    • @DanielBachler
      @DanielBachler  11 месяцев назад +1

      It's hard to make something that both works in a terse UI situation like a terminal but also at large scale. Are you thinking of a something specific? The closest that comes to mind for a good shell and a nice programming language would be Clojure with Babushka as a shell (github.com/babashka/babashka) - but I never got sufficiently comfortable with lisp syntax to enjoy that stack, even though I'm sure it's cool

    •  10 месяцев назад

      Well, it’s not that someone decided to separate them. The requirement to handle text IO and to access the system just creates a set of features that makes them different to other more general programming languages.

    • @howardjones543
      @howardjones543 10 месяцев назад +2

      considering many shells were written when a tty was ACTUALLY a 300 bps paper teletype, having the shell be as terse as possible made sense!

  • @hazardousnucleus659
    @hazardousnucleus659 6 месяцев назад

    Is it possible that you share you nushell config file?

    • @DanielBachler
      @DanielBachler  6 месяцев назад

      Sure! My nushell config is in an open git repo at github.com/danyx23/nu. It's a pretty messy workbench and not optimized for re-use but maybe still useful

  • @theodorealenas3171
    @theodorealenas3171 9 месяцев назад

    It's nice, and fun to try things with. I was hoping for a cool demo though, like the joining between different data types you mentioned.
    I'm sorry, I'm not going to use it. I have a blast playing with it but no.
    Eventually I have to set boundaries with what a shell is and isn't.

    • @DanielBachler
      @DanielBachler  8 месяцев назад +2

      Sure, to each their own :). I think it's also very valid to just come back once it reaches 1.0, at the moment there are definitely still a few things changing every month which not everyone might want to keep up wit

    • @theodorealenas3171
      @theodorealenas3171 8 месяцев назад

      @@DanielBachler I mean, I don't mind the syntax changes. Okay I don't remember them either. Fundamentally, NuShell looks like it would go well with a text editor and a live repl, but for a command line interface... I'm not sold.

  • @Nunya58294
    @Nunya58294 9 месяцев назад +1

    Still not gonna replace my beloved Bash shell.

  • @BrianWoodruff-Jr
    @BrianWoodruff-Jr 10 месяцев назад

    Why do you have a separate pyproject.toml and poetry.toml file? The poetry configuration can be inside the pyproject.toml file.

  • @intermarer9145
    @intermarer9145 4 месяца назад

    I searched around for about 10 minutes on how to install this on Linux Mint, but gave up in the end.

    • @DanielBachler
      @DanielBachler  4 месяца назад

      I don't know much about Linux Mint, but shouldn't it work to just download the binary from the release page? github.com/nushell/nushell/releases/tag/0.91.0

    • @intermarer9145
      @intermarer9145 4 месяца назад +1

      ​@@DanielBachlerYou see, I have an issue where I tend to overcomplicate things. Just downloading the binary worked of course... 😅

  • @angelustrindade132
    @angelustrindade132 Год назад +4

    The pros of a terminal with the cons of vscode

  • @ajbrady4357
    @ajbrady4357 11 месяцев назад +3

    Feels too much like Powershell

    • @DanielBachler
      @DanielBachler  11 месяцев назад +4

      I always felt that Powershell is clunky but it had some great ideas. To me, Nushell takes the best of Powershell and makes it nicely useable - but to each their own :)

  • @georgekelly4856
    @georgekelly4856 11 месяцев назад

    What vscode theme is this?

  • @JasonCunliffe
    @JasonCunliffe 11 месяцев назад +1

    hmmm
    ouchh
    Those borders just drive me nuts
    yuggly
    seems too verbose
    but piping functionally is cool
    Thanks for the demo intro!

    • @DanielBachler
      @DanielBachler  11 месяцев назад +3

      If you dislike the default border style then try the other options :) www.nushell.sh/book/coloring_and_theming.html#table-borders

  • @khanra17
    @khanra17 10 месяцев назад

    Amm amm amm

  • @cchance
    @cchance Год назад +5

    Soooo… powershell? No?

    • @marcgranlund6156
      @marcgranlund6156 Год назад +1

      as a Windows admin by day my take is: absolutely this is powershell for linux :D

    • @cchance
      @cchance Год назад +1

      @@marcgranlund6156 well more so powershell for people who dislike MS still, since theirs already powershell for Linux :S

    • @DanielBachler
      @DanielBachler  Год назад +6

      It definitely takes a lot of inspiration from Powershell! I worked with powershell before and I like the ergonomics of Nushell quite a lot more in the end. If you like powershell and work a lot in the terminal then definitely give Nushell a try

    • @nathanfranck5822
      @nathanfranck5822 Год назад +2

      I've always used terminals super minimally and hesitantly, it's cool to know that both powershell and nushell can process tables like this, make me curious about both

  • @TheMqyable
    @TheMqyable 8 месяцев назад

    It might be great, but unit it is not available in default repo on rhel and debian, I don't want even try it.

  • @AntoineamtoineStevan
    @AntoineamtoineStevan Год назад +7

    wow thanks a lot for this very enjoyable video