Live data from Hacker News

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

nushell.sh

81–90 of 215 posts

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

#81
post #42
post #17

Earlier quoted context omitted.

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.

Yet, almost all the basic tools in a Unix system are written in C.

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

#82

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.)

The fact PowerShell has this masochistic tendency to have commands that start with capital case already makes it outside of the realm of consideration for me. It's absolute nonsense. Also I have to say your example is extremely confusing and would probably take quite a bit of time to write IRL. For reference, the equivalent in sh would be: find . -maxdepth 1 -type f -size +10M -exec ls -lt {} + Or a very terse exampl…

tbh, I have used way more bash than ps in my life so far, and the following command is the only one, I understand without googling anything:

Get-ChildItem | Where-Object { $_.Length -gt 10MB } | Sort-Object LastWriteTime `

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

#83
post #73

I'm sure there's a lot more once you get to more advanced stuff, but going through their System examples has me puzzled: > ls | where type == dir or in Bash: `ls -d` > ps | where cpu > 0 | sort-by cpu | reverse or in Bash: `htop` ? > ps | where name == Notepad2.exe > # find process, then ... > ps | where name == Notepad2.exe | get pid.0 | kill -9 $in or in Bash: `pkill Notepad2.exe` > Pipeline content to clipboard Or…

He’s giving simple examples everyone can quickly understand.

When I show people the same advantage that PowerShell has over bash I pick harder problems where bash/gnu tools have no trivial answers. But then people get sour grapes and say “I don’t need to do that kind of thing anyway.” The reality of course is they avoid those harder problems and solve them manually or with different tools (Python).

Sorting is as good example, because while commands like ‘ps’ have some built in sorting capability, it is limited and inconsistent with other tools. You can sort by some columns, but not others. Sorting by the same field is often a different option across different tools even if they manipulate the same objects, etc…

If you would like a harder problem: kill every process on the machine run by the user “ash” that has used more than 1 hour of total CPU time but only those of his processes that are in the top 5 in the entire system by memory usage.

Hint: Don’t kill anyone else’s processes by accident even if their user name is “flash” or if their process name is “bash”. Also don’t confuse instantaneous %CPU with total CPU usage.

Did I say total CPU? Oops, I meant total kernel time used! My mistake. Update your a script, that should be a simple change… right?

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

#84
post #73

I'm sure there's a lot more once you get to more advanced stuff, but going through their System examples has me puzzled: > ls | where type == dir or in Bash: `ls -d` > ps | where cpu > 0 | sort-by cpu | reverse or in Bash: `htop` ? > ps | where name == Notepad2.exe > # find process, then ... > ps | where name == Notepad2.exe | get pid.0 | kill -9 $in or in Bash: `pkill Notepad2.exe` > Pipeline content to clipboard Or…

As with almost everything, Bash is easy once you learn how to use it ; )

I think this tool is useful for people who need to use the terminal right now, without having to spend quite a bit of time learning, e.g., Bash. Your point about the portability of Bash is, of course, valid. It just that sometimes you need to get stuff done quickly without parsing, at times unfriendly, documentation of more mature tools.

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

#85

I like the idea of piping structured data between processes instead of streams of bytes, but that's what PowerShell is for. I don't think I've ever met another dev who likes PowerShell

> I don't think I've ever met another dev who likes PowerShell

I have, a few! But they are the kind of dev to never publish their work anywhere, not even little shell scripts. Secretive windows power users

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

#86
post #45

Earlier quoted context omitted.

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 t…

Blocks always use braces. Expressions use parentheses for grouping sub-expressions. It's the same as many C-like languages. I can't imagine any situation where you would be confused which one you need to use.

Blocks always use braces, but sometimes you are passing parameters and other times you are passing a block.

If I spent all day as a PowerShell dev I'm sure I would know it, but for something I reach for once or twice a year intuitiveness is a feature I would like to have.

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

#87
post #73

I'm sure there's a lot more once you get to more advanced stuff, but going through their System examples has me puzzled: > ls | where type == dir or in Bash: `ls -d` > ps | where cpu > 0 | sort-by cpu | reverse or in Bash: `htop` ? > ps | where name == Notepad2.exe > # find process, then ... > ps | where name == Notepad2.exe | get pid.0 | kill -9 $in or in Bash: `pkill Notepad2.exe` > Pipeline content to clipboard Or…

I think you've partly proven that nushell is useful. `ls -d` doesn't list directories, it lists only the files given as arguments instead of their children. Also, htop is nothing like a scriptable and composable pipeline from ps, and there's no reason `pkill` couldn't co-exist with the equivalent of `kill $(ps | grep Notepad2 | grep -v grep)`.

Dozens of specific commands and flags for specific usecases aren't always enough, and, dare I say it, counter to the UNIX philosophy.

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

#88

Earlier quoted context omitted.

It's not Microsoft based?

So there's no support from one of the largest tech companies in the world?

> one of the largest tech companies in the world

Bigger isn't better my guy

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

#89
post #73

I'm sure there's a lot more once you get to more advanced stuff, but going through their System examples has me puzzled: > ls | where type == dir or in Bash: `ls -d` > ps | where cpu > 0 | sort-by cpu | reverse or in Bash: `htop` ? > ps | where name == Notepad2.exe > # find process, then ... > ps | where name == Notepad2.exe | get pid.0 | kill -9 $in or in Bash: `pkill Notepad2.exe` > Pipeline content to clipboard Or…

[deleted]

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

#90

I like the idea of piping structured data between processes instead of streams of bytes, but that's what PowerShell is for. I don't think I've ever met another dev who likes PowerShell

I'm of the opinion that structured data is something PowerShell got 100% right; people tend to dislike PowerShell for other reasons (verbosity, startup time, Windows-first history).
Post reply on HN