Live data from Hacker News

Nushell.sh ls | where size > 10mb | sort-by modified

nushell.sh

41–50 of 215 posts

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#41

du -s * | sort -n -r | sed 10q

Okay, but now show me the size of the file in a human readible format next to the name.

You can use the "-h" (human-readable) options to du and sort to do this:

  $ du -sh * | sort -rh
  20M dist
  6.9M pebble
  1.5M internal
  308K cmd
  ...

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#42
post #17
post #15

Earlier quoted context omitted.

I assume the parent comment did not make fun of nushell advertizing this, but instead about the rust community advertizing itself all the time.

To be honest, they have good reason. Being written in a strongly typed, memory-safe language is a huge advantage. Obviously it's not the primary thing to look out for, but I do prefer tools that are written in it.

There are plenty of strongly typed memory safe languages. In fact I think those are the majority of popular languages.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#43

Earlier quoted context omitted.

Historically we would discourage shell users from cat somefile.txt | whatever and instead tell them to use either whatever or, if the command accepts input file names as arguments then use those like whatever somefile.txt or whatever -i somefile.txt etc But perhaps in fish, “useless use of cat” is not so useless and would be recommended? (I mean aside from the fact that they seem to recommend their “open” command, an…

For some reason I never liked to do it the "right way". First of all it doesn't seem to actually matter. But most of all the cat way just aligns with my mental model more. Data flows left to right, if you catch my drift. It also makes it easier to add arguments to the end if re-running it.

While I get your point...

> It also makes it easier to add arguments to the end if re-running it.

I'd like to point out that a redirection doesn't have to be the last thing in a command. E.g. the common 'echo >&2 "some message"' works fine.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#44

[zsh]$ ls -l *(Lm+10om) zsh supports extended globs, this says: -l give me a long listing “*(…)” of any file Lm+10 who’s size “L” in megabytes “m” is greater than 10 “om” ordered by modification ascending

Wouldn't you want to use 'ls -lt' (sort by time) (or possibly with '-r' if you really want oldest first)? (I.e., does 'om' sort the glob passed to 'ls', which it will then reorder, or does zsh do something magic with the 'ls' command?)

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#45
post #23

Earlier quoted context omitted.

PowerShell isn’t that verbose, compared to NuShell. The ls example would be (with standard PowerShell aliases): gci | where { $_.Length -gt (10 * 1024 * 1024) } | sort LastWriteTime -gt might seem weird, but it’s better than overloading >. (Also, I like the fact that PowerShell is built into Windows and has a large corporation behind it.)

Sorry but that looks terrible.

I don't mind the looks but I find it hard to debug and have a poor instinct for "does this need a curly bracket or a parens?" That's my real issue with PowerShell, I find it very hard to predict what will work unless I know exactly what the rule is.

Shell has similar issues but I've put 20 years into it so the knowledge is there. Every time the PowerShell people describe PowerShell I think "that sounds awesome" but the ergonomics don't work for me.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#46
post #23

Earlier quoted context omitted.

Sorry but that looks terrible.

What about it looks terrible? The braces are necessary, because this is a lambda.

You don’t need the lambda. Where-Object can just take the Length property.

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#47

[zsh]$ ls -l *(Lm+10om) zsh supports extended globs, this says: -l give me a long listing “*(…)” of any file Lm+10 who’s size “L” in megabytes “m” is greater than 10 “om” ordered by modification ascending

Cool but that’s as opaque and hard to understand as sacrificing a goat to order ls output.

It’s of course possible to do with existing shells, but it’s impossible to argue that it’s a clear

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#48
post #36
post #16

Earlier quoted context omitted.

This reminds me of how Fish handles process substitution without requiring a special syntax. I love it! It may seem a bit odd or even cumbersome to experienced shell programmers, but in my experience with Fish, this kind of thing helps a lot with ease of learning.

It is much much better to have things be actual commands (which have a uniform syntax, and are `--help`able) rather than obscure sigils like $(#!@$). Fish is amazing!

Many of these next-gen shells like Nushell are clearly (and sometimes explicitly) inspired equally by Fish and by PowerShell, and it shows. It's a brilliant combination!

Re: Nushell.sh ls | where size > 10mb | sort-by modified

#49

This looks extremely interesting! Is anyone using it as a daily driver on Linux? How has your experience been?

I have been using this on my Linux and windows machine as a daily driver. It's cross platform approach to handling commands, and overall usability is what made me switch to this completely. It takes a little while to get used to, especially when coming from bash, but if you know powershell already, I'd say just give it a go.
Post reply on HN