18 ms·
Nushell.sh ls | where size > 10mb | sort-by modified
- kasdi 4y agoStill not 1.0 after all those years?
- nailer 4y agoThis has been on HN previously but it's a couple of years later and pleased to see it's still a very active project https://www.nushell.sh/blog/ https://www.nushell.sh/blog/ with good documentation: https://www.nushell.sh/cookbook/ https://www.nushell.sh/cookbook/
- derhuerst 4y agosome past HN discussions: - https://news.ycombinator.com/item?id=20783006 https://news.ycombinator.com/item?id=20783006 - https://news.ycombinator.com/item?id=27525031 https://news.ycombinator.com/item?id=27525031 - https://news.ycombinator.com/item?id=33419944 https://news.ycombinator.com/item?id=33419944
- david2ndaccount 4y ago> Nu has great error messages The example is actually terrible though. It implies that changing the 10 to a string will make division a valid operation. It’s also incredibly verbose.
- lloydatkinson 4y agoWhat is the advantage over powershell?
- bobleeswagger 4y agoIt's not Microsoft based?
- BrainBuzzer 4y agoIt's cross platform. Although of you're coming from powershell background, it is easier to learn.
- shortrounddev 4y agoPowershell is also cross-platform
- BrainBuzzer 4y ago> Powershell is also cross-platform I was replying to your "Microsoft based" comment. And yes, powershell is also cross platform and open source.
- deleted 4y ago[deleted]
- shortrounddev 4y agoSo there's no support from one of the largest tech companies in the world?
- bobleeswagger 4y ago> one of the largest tech companies in the world Bigger isn't better my guy
- alpaca128 4y agoI avoid MS products like the plague nowadays exactly because of their "support", including free overnight OS sabotage.
- huhneverthot 4y agoIt's not batshit infuriating to use? Idk, I was an OG PowerShell, I'd take nushells approach every day of the week.
- xnyanta 4y agoWhat's the advantage of this over PowerShell?
- tosihakkeri 4y agoThis is written in Rust /s
- avgcorrection 4y agoNo, that’s not mentioned as an advantage on the website.
- k0k0r0 4y agoI assume the parent comment did not make fun of nushell advertizing this, but instead about the rust community advertizing itself all the time.
- huimang 4y agoTo 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.
- zozbot234 4y ago> Being written in a strongly typed, memory-safe language is a huge advantage. Great point, C# is a strongly typed and memory-safe language if you don't use unsafe. So this really is a huge advantage for PowerShell.
- vips7L 4y agoThere are plenty of strongly typed memory safe languages. In fact I think those are the majority of popular languages.
- akira2501 4y agoSo, '>' isn't for redirection anymore. How does one do that? open foo.txt | append "world"| save --raw foo.txt Oh.
- pxc 4y agoThis 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.
- andrepd 4y agoIt 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!
- pxc 4y agoMany 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!
- amelius 4y agoI think the problem with this approach is that it breaks down at some point, and then your only option is to rewrite the entire thing in a real scripting language. I.e., there is no graceful scaling path.
- pxc 4y agoI suppose I'm more optimistic. From my point of view, structures pipelines and some of the goodies that come with it (like better error handling), can make a shell language into a perfectly capable scripting language. I think the big weakness for these new shells is in the small sizes of their library ecosystems. But PowerShell shows what a language of this kind can do with a sizeable ecosystem and some OS integration.
- deleted 4y ago[deleted]
- mbStavola 4y agoI have nothing but positive things to say about nushell, but I do wish the describe command took a positional argument rather than just being piped into. I was trying to write a pipeline that could give me all the versions from a Cargo.toml and "flatten" any records, but got stuck trying to use describe. Ex: open Cargo.toml | get dependencies | transpose | rename dep version | each { |row| let version = $row.version; if (describe $version) =~ "record" { $version.version } else { $version } }
- msmart 4y agoI would use open Cargo.toml | get dependencies | transpose | rename dep version | each { |row| if (($row.version | get -i version | default "" ) != "") { $row.version.version } else { $row.version } } not sure whether that's the best way.
- evntdrvn 4y agoHave you tried opening up a feature suggestion? The maintainers are very receptive/helpful from my experiences.
- lordofgibbons 4y agoThis looks extremely interesting! Is anyone using it as a daily driver on Linux? How has your experience been?
- qorrect 4y agoI second this question. I was using FISH for quite a while and really liking it, but there was always something that it was incompatible with and had to eventually give it up.
- aldanor 4y agoI gave up on fish many years ago because of various incompabitilities (e.g. syntax like `FOO=bar some-cmd` or `env FOO=bar some-cmd` etc), but to be fair, they have managed to patch lots/most of those. Returned back (from zsh) to fish this year and am super happy. Still the best built-in completion / history auto-suggest that I've seen in any shell so far, and super-fast at that. Most importantly, barely any config needed (no needs for oh-my-zsh, prezto and all of those).
- BrainBuzzer 4y agoI 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.
- huhneverthot 4y agoYes, daily driving it (it's my default shell in zellij), and have ported my use-every-5-mins scripts to it. It's VERY refreshing, but I still have issues with it not short-circuiting when an error is thrown in a loop... Which I suspect will get fixed in time...
- zzo38computer 4y agoI have been given a link to this when I was describing my ideas of an operating system design, since some of the ideas are similar. However, many ideas are different, since the operating system is in many ways fundamentally different from Windows and from POSIX. Some of these differences may allow such a similar idea to even work better in some ways, possibly.
- felixgallo 4y agodu -s * | sort -n -r | sed 10q
- theossuary 4y agoOkay, but now show me the size of the file in a human readible format next to the name.
- deleted 4y ago[deleted]
- PeterWhittaker 4y agodu -s -h * | sort -r -h
- deleted 4y ago[deleted]
- benhoyt 4y agoYou 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 ...
- felixgallo 4y agoit's already in a human readable format next to the name.
- deleted 4y ago[deleted]
- matja 4y agoadd: | numfmt --to=iec
- e12e 4y ago"sed 10q" is equivalent to "head"?
- jmole 4y agoRead this as "Nutshell", which would have been a really cool name for a shell.
- cirrus3 4y agosame here
- robertlagrant 4y agoI read that several times thinking it was Nutshell. And now I wish it were.
- steveklabnik 4y agoI’ve been using nu as my main shell for a few years now. Very happy with it.
- CraigJPerry 4y ago[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
- loeg 4y agoWouldn'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?)
- CraigJPerry 4y agoyeah if you were typing this case yourself you would use -lt but i figured it was worth showing that extended globs can be combined. This globbing functionality in zsh is separate from the ls command, so no ls magic here, but the ls builtin in zsh does have some useful extras in it all the same
- orf 4y agoCool 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
- CraigJPerry 4y agoDepends what you’re optimising for. Are you optimising for readability - e.g. maybe you share shell history with team mates for example. Or are you optimising for getting your thoughts transcribed to the machine as quickly as possible. It’s usually this case for me. I tend to maintain a huge shell history so i really like the terse format for quickly filtering down my historical commands. Writing shell scripts might be a good case for the longer form style although bourne-esque syntax is burned into my fingertips after all these years that long form is not going to be useful to me.
- jedisct1 4y agoI tried to use it as my main shell for a couple days, found it fun and potentially useful, played with its unique features... and eventually uninstalled it and went back to zsh. For 99.99% of what I use a shell for, Nushell doesn't do anything that I can't do with a regular shell. Maybe just because I'm used to shells/sed/awk/etc. For the few cases where Nushell could be useful, I can usually do the same thing with Vim/Emacs/VSCode or a trivial Python/Ruby script.
- HervalFreire 4y agoWhat if someone starts from a clean slate. Which shell is better? That is the question. Old habits hold us back from progress in usability. Eventually if one system is better it should completely replace the old system. But only if it's better. What one power user deems as "useful" according to his own usage patterns shouldn't be a metric for measurement. I haven't played with nushell yet, but it actually seems more powerful then python for shell tasks. All the data structures are catered towards easy visualization and parsing parameters related to a shell. Python does not have such convenience.
- sp33der89 4y agoFish is that shell for me. I tried nushell and zsh. zsh required a bunch of setup and nushell was too young. Whereas fish has really great defaults and enough of support to just go and have fun.
- MaxMatti 4y agoHave you tried oh-my-zsh? It's what got me to install zsh on all my servers, even at work. Just run their setup script, let it change your default shell and set your preferred theme in the config.
- sp33der89 4y agoI have tried oh-my-zsh, but still fish was easier to get started with. Especially with autocompletions. However oh-my-zsh was pleasant to use as well!
- guilhas 4y agoI find this project interesting But doesn't it look like too monolithic? That will have problems with maintenance and scaling? And features that overlap with many already existing cli tools?
- ripley12 4y agoI think Nu generally plays nicely with other CLI tools and data sources. For example if you've got an external executable that emits JSON, all it takes is `from json` to convert that output to a Nushell table.
- joveian 4y agoThat inspired me to give it a quick try, however the assumption that white on bright white is a readable color conflicts with the need to make them the same color for other software that I use (which only use eight colors and I want white to be white). I'm guessing this might be configurable for anyone sufficiently interested.
- huhneverthot 4y agoIt's so wildly awesome to deal with data natively in nushell than donhacky shit with jq and strings... In bash. No thanks.
- guilhas 4y agoYou can try this one too https://github.com/multiprocessio/dsq https://github.com/multiprocessio/dsq
- ghusto 4y agoI'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 on MacOS: `anything | pbcopy` The first example is actually the only one that makes sense to me: > ls | where type == file Amazingly, there's no straightforward way to tell `ls` to output only files (that I know of): `ls -p | grep -v /` I don't mean to knock it, but I think it's better to learn the standard tools available everywhere than invest any time in tools that aim to lessen the learning curve.
- boustrophedon 4y ago`find . -type f -maxdepth 1`
- AdamJacobMuller 4y ago> Amazingly, there's no straightforward way to tell `ls` to output only files (that I know of): `ls -l|grep -e^-` Unless you meant without pipes/grep in which case I think no, but, you're bumping up against the fact that `ls` is really more of a user-presentation tool than for scripting. Use `find . -type f` maybe with some `-maxdepth 1`
- jiggawatts 4y agoHe’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?
- shortrounddev 4y agoI 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
- lionkor 4y ago> 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
- ripley12 4y agoI'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).
- pmarreck 4y agoI'd actually like the ability to do either raw bytes (traditional) or structured bytes (the NuShell/PowerShell idea) in an "opt-in" scenario. This would also allow a smoother transition/lack of needing to fully commit right off the bat. I've considered writing wrappers for standard utilities in Bash/Zsh that accept and output structured data in JSON (or maybe a denser serialization format that can easily convert to JSON?) instead of a raw byte stream that you could then just use regular old pipes with (a lot of `jq` would likely get called in between...) The "structured" versions of the utilities would have some namespacing convention such as a "struct_" prefix (or perhaps optionally, or aliased, for brevity, "s_") or (another naming idea I just had... oooh, I like this one) they would be boxed in brackets, so "[ls]" or "]ls[" would call "structured ls" (note that brackets without spaces around them are valid name characters) To handle the transition to/from structured data, an idea I had was to omit one of the brackets in these names, so for example "ls[" would emit structured data but accept (well, assuming "ls" was a command that took stdin) an unstructured bytestream, and something like "]cat" would take in structured data on stdin but emit raw data... "cat[" would take raw data and... interpret it as JSON? or something? and output that as structured data? I don't know, it has to be fleshed out, but this could work maybe! To get the JSON data back to a visual format like a table, we'd probably have to explicitly do what NuShell implicitly calls when you don't provide it (I forgot the name of it). anyway, I haven't even begun a POC of this idea, but it was one I had. Anyone else like this idea?
- ape4 4y agoI like the trend of commands adding json output. Then you don't need to get a new shell just incrementally add other commands than can process json.
- pxc 4y ago> other commands than can process json Happily, this includes import/conversion functions for new shells, so this plays nice with efforts like Nushell as well.
- dmix 4y agoPlus having less cryptic version of jq is a big win considering how often we all work with JSON files these days. It should be a 'primitive' in shells like strings.
- reisse 4y agoFew more decades of shell development and the people involved will maybe discover GUI with hotkeys. /s Seriously though, for me their front page fails to give a convicing example how it's better than existing shells for a typical shell workflows. Even the last one, which supposed to demonstrate better error messages, shows a cryptic error "change a or b to be the right types and try again". Perhaps type checking can help to say which argument is wrong and how to fix it? Now it's literally "one of your arguments is wrong, check man and try again".
- smallerfish 4y agoWhat's the story with not having a deb / flatpak / appimage or snap distribution? Just lack of resources to help package?
- ripley12 4y agoDon't think we've had any requests for those, but we'd welcome contributions if someone wants to make it happen. For now, Homebrew works if you want a cross-distro way to install Nu on x64 Linux.
- codethief 4y agoPersonally, I would love to give Nushell a try but having to install another package manager (Homebrew) first…
- ripley12 4y agoYou might be covered by one of the other package managers: https://www.nushell.sh/book/installation.html#package-managers https://www.nushell.sh/book/installation.html#package-manage... We also publish binaries: https://github.com/nushell/nushell/releases https://github.com/nushell/nushell/releases
- e12e 4y agoLooks like it's fairly trivial to build/get via cargo: https://www.nushell.sh/book/installation.html#build-using-crates-io https://www.nushell.sh/book/installation.html#build-using-cr... I'm not likely to use brew on Linux (rather stow/xstow if I have to).
- HervalFreire 4y ago[dead]
- ryukoposting 4y agoSeems like a less-asinine take on the ideas underlying PowerShell. Neat!
- enoch2090 4y agoThis is fun, but reading the commands[1] reminds me of learning a new language. There are just too of them, and they are all pipelined in a functional manner so I need to understand the I/O of them. In that case, why would one bother remembering all of those, when Xonsh or IPython does similar job to their data, only with a few more lines of (more familiar) code? [1]: https://www.nushell.sh/commands/ https://www.nushell.sh/commands/
- cormacrelf 4y agoI have written a bunch of nu and: no dot method syntax means you need to browse documentation for literally everything. So much worse than your average programming language, which takes the data type + you enter a dot = it suggests all the relevant methods. The Nu docs are better than they were a few years ago but as far as I can tell they keep changing command names, having subtle changes of behaviour for commands with the same name but apparently different implementations for different data types, having a crucial command listed under a weird name that takes an hour to find, etc etc. If I need to wrangle some JSON again I think I’ll just use Python.
- enoch2090 4y agoThat sounds really promising though, you convinced me. Will have a try.
- ripley12 4y ago> subtle changes of behaviour for commands with the same name but apparently different implementations for different data types This was one of the biggest problems with Nu's dataframe functionality; it should be resolved now that we no longer ship with dataframes by default. Totally agreed on dot method being nice for discoverability, that's something we need to do better on.
- ripley12 4y agoI don't think you need to remember all of Nushell's commands (I certainly don't). You can go far with a handful of important ones; off the top of my head, get/select/where/sort-by/open are the most important. This is something we should communicate better in the docs, I'll see what I can do.
- tormeh 4y agoMy problem with alternative shells (anything not bash) is that I have to learn bash anyway, and if I want to use a scripting language that requires me to first install a runtime, drop into it, doesn't work on colleagues machines, etc. then there are many non-shell alternatives that are better. I'll learn nushell or whatever once a mainstream or somehow desirable distro ships with it as their default shell.
- xcdzvyn 4y agoI have the same problem. The only viable neo-shell in my eyes would have to be 100% Bash compatible anyway, so what's the point?
- bmelton 4y agoThis is the same reason I eventually learned and stuck with Vi(m). Implementing a project on a massive array of SPARC Solaris boxes and every "easy' tool I'd learned just... wasn't there. I had kind of learned Vi at that point, but wasn't remotely proficient in it, and had only gotten as far as I had due to a bunch of cool plugins I'd installed that definitely weren't available.
- zamadatix 4y agoThat last part is often forgotten. I usually stick with defaults (or as close as I reasonably can) not because they are functionally better but because for most things I don't have the return on learning and regularly using two instances of ${tool} isn't worth the extra time. Sometimes it's a pain but it seems to pay off.
- deafpolygon 4y agoAnd when I'm doing something on my local machine - very often, a more modern tool is required anyway. (Visual Studio in the case of C#/C++, and VS Code is infinitely quicker and simpler to get up and going with when editing other source code).
- ParetoOptimal 4y ago
- kubb 4y agoIt would be neat to be able to add durations to dates. This would let me e.g. get all files that are newer than an hour: ls | where modified > time now - 1hr
- timmb 4y agoI misread this as Nutshell. Slightly disappointed that wasn’t its actual name (perhaps it’s already taken).
- guilhas 4y agoWhat is the general opinion about Nushell and this tools (or others)? https://github.com/multiprocessio/dsq https://github.com/multiprocessio/dsq https://github.com/jqnatividad/qsv https://github.com/jqnatividad/qsv https://csvkit.readthedocs.io/en/latest https://csvkit.readthedocs.io/en/latest https://github.com/kellyjonbrazil/jc https://github.com/kellyjonbrazil/jc https://github.com/TomWright/dasel https://github.com/TomWright/dasel https://github.com/johnkerl/miller https://github.com/johnkerl/miller https://stedolan.github.io/jq https://stedolan.github.io/jq https://github.com/harelba/q https://github.com/harelba/q ...
- velox_neb 4y agoHow well can you use this as utility from your current shell, without replacing it? Something like "nu <command>" to execute nu commands from inside bash?