8 ms·
It would be nice to have a collection of modern/faster/saner alternatives to common unix tools and such utilities (made in rust or not) that becomes standard --
by coldtea 9y ago
It would be nice to have a collection of modern/faster/saner alternatives to common unix tools and such utilities (made in rust or not) that becomes standard -- or at least easily installable in linux distros and OS X. Not for replacing those tools, but for supplementing them.
Thinking of stuff like fd and:
ripgrep: https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep (grep/ag alt)
xsv: https://github.com/BurntSushi/xsv https://github.com/BurntSushi/xsv (csv tool)
exa: https://the.exa.website/ https://the.exa.website/ (ls)
una: https://github.com/jwiegley/una https://github.com/jwiegley/una (multi-compression utils wrapper)
tokei: https://github.com/Aaronepower/tokei https://github.com/Aaronepower/tokei (loc stats)
And of course this:
https://github.com/uutils/coreutils https://github.com/uutils/coreutils
- deleted 9y ago[deleted]
- deleted 9y ago[deleted]
- empath75 9y agoRedox already has a core untils library.
- kuwze 9y agovgrep: https://github.com/fmthoma/vgrep https://github.com/fmthoma/vgrep (Haskell vertical grep)
- nerdponx 9y agoDoes the Fish shell count? Consider also the "fuzzy finder" FZF.
- StavrosK 9y agoThe fish shell is the only one that counts. Fish is life.
- bm1362 9y agoI appreciate all these new incarnations of old school tools but end up sticking with the basics regardless. When I'm sshing into a box to figure out whats going on, my toolset is mostly limited to top, find, xargs, awk, grep, df, du etc. Even local development now, I'm mostly debugging on a docker container running alpine or ubuntu. Knowing the right incantations is useful in that context and keeps me from installing better tools until they become part of the distro we deploy with.
- burntsushi 9y ago> When I'm sshing into a box to figure out whats going on, my toolset is mostly limited to top, find, xargs, awk, grep, df, du etc. I wrote some of the tools on coldtea's list, and I'm pretty much the same way in that I stick to distro tooling in vanilla setups. But I spend enough time on my local workstation that having "better" (read: creature comforts) is worth it there! But yeah, if you spend most of your time in vanilla setups, then tools not in the standard distro repos are a hard sell.
- j2kun 9y agoWho makes the decision on what gets standardized into the distro?
- burntsushi 9y agoThe people in charge of the distro. Governance structures vary. And sometimes it's not just about who gets to decide, but also, the technical work required to do it. People need to put in the work to make Rust applications packageable according to the distro's standards. YMMV.
- deleted 9y ago[deleted]
- IgorPartola 9y agoThis. And at some point enough of these alternatives might accumulate that a new distro will form using only the new tools. The issue is that most people don’t realize just how entrenched the existing tools are. They are a part of cross distro standards because often times they are used for scripting. Imagine a distro that decided to not ship ls in favor of exa. Ok it’s own this isn’t a problem at all. But combined with the overwhelming amount of FOSS you might want to install on top of your distro, you would suddenly need ls anyways.
- cies 9y agoIt would be even nicer to have an opensource project that pushes a set of these tools, that then can get picked up by the distros such that in 5 year you can expect these all to be included at a reasonable version such that you do not have to install them by hand on each machine that you land on. On the other hand, you may want to keep some smart dotfiles around that installs them in ~/bin
- stevekemp 9y agoThat's the kind of idea that lead to Joey Hess's "moreutils". https://joeyh.name/code/moreutils/ https://joeyh.name/code/moreutils/
- cies 9y agoYes. But not entirely. Also the set of tools that he combines is ment to be an addition, not a (potential) replacement. (Joey is a boss, did not know of this project of his -- thanks for pointing out)
- trashcan 9y agoack: https://beyondgrep.com/ https://beyondgrep.com/
- chrismorgan 9y agogrep came, then ack-grep, then silver-searcher and a few others, finally ripgrep. For most purposes, ripgrep (the one written in Rust) is the best of all of these tools, typically being the fastest and also the most Unicode-compliant, with the main downside being its non-deterministic ordering of output (because it searches files in parallel). The only reason for using ack these days is if you’re already invested in a Perl workflow and can use some of the Perl magic powers, and don’t care about comparatively poor performance. That’s not many people.
- petdance 9y agoWhat do you mean by a "invested in a Perl workflow"? Do you mean "comfortable with Perl regexes"? Other reasons that you may want to use ack: * You want to define your own filetypes * You want to define your own output using Perl regexes * You need the portability of an uncompiled tool in a single source file that you can drop into your ~/bin when you can't install or compile anything on the box. * You don't want to have to deal with a Rust runtime.
- burntsushi 9y agoI'd like to make a few clarifications if you don't mind! You can define your own file types with ripgrep on the command line (albeit not in a config file, so you end up needing a wrapper script or an alias). ripgrep has pre-compiled binaries that work out of the box on Windows, Mac and Linux. "Rust runtime" isn't really a thing. It's like you saying you don't want to deal with a C runtime.
- petdance 9y agoThanks for the clarifications. I was under the impression that Rust required a lot of tough infrastructure. I'm glad to see that ripgrep lets you define your own types. That ripgrep does it with globbing vs. the ways that ack allows is just another of the differences between the tools that people have to decide about.
- nemild 9y agohttpie: https://github.com/jakubroztocil/httpie https://github.com/jakubroztocil/httpie (http client) jq: https://stedolan.github.io/jq/ https://stedolan.github.io/jq/ (lightweight JSON client)
- jasonm23 9y agoPup deserves a mention too. https://github.com/ericchiang/pup https://github.com/ericchiang/pup
- sjmulder 9y agoentr, too: http://entrproject.org http://entrproject.org
- baby 9y agoI've always used cloc instead of tokei: https://github.com/AlDanial/cloc https://github.com/AlDanial/cloc I use "x" in oh-my-zsh plugins instead of una. https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins/extract https://github.com/robbyrussell/oh-my-zsh/tree/master/plugin... I use "ag" instead of ripgrep. https://github.com/ggreer/the_silver_searcher https://github.com/ggreer/the_silver_searcher I use "fpp" instead of vgrep. https://github.com/facebook/PathPicker https://github.com/facebook/PathPicker Anybody has tried them and has an opinion on which is better?
- coldtea 9y agoI've tried ag and ripgrep. ripgrep is better.
- baby 9y agoI just tried ripgrep and it's faster and I think I like the output better :)
- JelteF 9y agoIt is definitely faster. The ripgrep author did extremely extensive benchmarking to a lot of tools. For the most common usecase check out this section, but the rest of the article is very much worth a read as well: http://blog.burntsushi.net/ripgrep/#subtitles-literal http://blog.burntsushi.net/ripgrep/#subtitles-literal
- slavik81 9y agoThe HN thread about it had a good discussion between the ag and ripgrep authors. https://news.ycombinator.com/item?id=12567328 https://news.ycombinator.com/item?id=12567328
- keenerd 9y agoHow about better but only in a very specific way? gz-sort: http://kmkeen.com/gz-sort/ http://kmkeen.com/gz-sort/
- snorrah 9y agoIdeally it would be nice if common utils were redeveloped to have optimisations that weren’t thought of or available back in the day
- burntsushi 9y agoThat's basically what's happening. AFAIK, ack kinda started it all by observing, "hey, we frequently have very large directories/files that we don't actually want to search, so let's not by default." Depending on what you're searching, that can be a huge optimization! Tools like `git grep` and the silver searcher took it a step further and actually used your specific configuration for which files were relevant or not. (Remember, we're in best guess territory. Just because something is in your .gitignore doesn't mean you never want to search it. But it's a fine approximation.) Was this a thing back when the BSD and GNU greps were being developed? Was it common for people to have huge directory trees (e.g., `node_modules` or `.git`) lying around that were causing significant search slow downs? Not sure, but it seems to have taken a while for it to become a popular default! There are of course other tricks, and most of those are inspired by changes in hardware or instruction sets. For example, back in the day, a correctly implemented Boyer Moore was critical to avoid quadratic behavior by skipping over parts of the input. But that's lessish important today because SIMD routines are so fast that it makes sense to optimize your search loop to spend as much time in SIMD routines as possible. This might change how you approach your substring search algorithm! ... so what's my point? My point is that while sometimes optimizations are classic in the sense that you just need to change your heuristics as hardware updates, other times the optimization is in the way the tool is used. Maybe you can squeeze the former into existing tools, but you're probably not going to make much progress with the latter. I remember when I first put out ripgrep. Someone asked me why I didn't "just" contribute the changes back into GNU grep. There are a lot of reasons why I didn't, but numero uno is that the question itself is a complete non-starter because it would imply breaking the way grep works.
- wruza 9y ago>”hey, we frequently have very large directories/files that we don't actually want to search, so let's not by default” >Was this a thing back when the BSD and GNU greps were being developed? Was it common for people to have huge directory trees (e.g., `node_modules` or `.git`) lying around that were causing significant search slow downs? Not sure, Sure, actually. It was called “build” and it was moved out of source code hierarchy to not interfere with tools. Pretty clever, and you don’t have to patch every tool each time new build-path appears. This should lead us to some conclusion, but I cannot figure out which. Do you?
- anonacct37 9y agoMaybe something like "BusyBox": a single multi-use executable, would help with adoption. If you like one executable you get the whole useful package.
- TeddyDD 9y agoI like tool called "just". It's simple command runner inspired by make. https://github.com/casey/just https://github.com/casey/just One could argue that tool like this makes no sense since make is installed almost everywhere but I'm already using fish shell so one more non standard tool makes no difference. I appreciate simplicity of "just".
- Ezku 9y agoReally cool, I've needed this quite a number of times. Thanks for the tip!
- Manishearth 9y agoGiven that "moreutils" is taken, and Rust has a metallic theme, if this should happen the project should totally be called "oreutils".
- parmesan 9y agohttpie: https://github.com/jakubroztocil/httpie https://github.com/jakubroztocil/httpie (cURL for humans) Httpie is my goto http cli for all systems. Pretty much PostMan (that a lot of ppl use for no reason) but without annoying UI and on a single line. Formats JSON and colors it right in the terminal as well. Has a super nice query, header and post body syntax. Works well with sessions and cookies.
- zimpenfish 9y ago> Pretty much PostMan (that a lot of ppl use for no reason) I can't see anywhere in the httpie docs about capturing variables from and/or running tests on the HTTP responses - it's an extremely powerful feature of Postman when you're debugging non-trivial HTTP flows.
- joshka 9y agoand nor should it. If you think the unix way and use a tool that excels in that you'll find your path to success (e.g. jq). $ userId=$(http get https://jsonplaceholder.typicode.com/posts/1 | jq '.userId') $ http get "https://jsonplaceholder.typicode.com/users/$userId" | jq '{name,email}' { "name": "Leanne Graham", "email": "Sincere@april.biz" }
- earenndil 9y agoI'm afraid I don't quite see the purpose of una. There are really only two command lines you have to remember. `7z x` for anything.7z and anything.rar. And `tar xf` for anything.tar.anything.