7 ms·
My favorite 'new wave Unix' utility by far. So ergonomic, yet an easy switch from egrep.
by jjice 5y ago
My favorite 'new wave Unix' utility by far. So ergonomic, yet an easy switch from egrep.
- RBerenguel 5y agobat [0] (a cat replacement) and fzf [1] are the other two I would miss dearly, standing above some other "new" tools I use very regularly. [0]: https://github.com/sharkdp/bat [1]: https://github.com/junegunn/fzf
- kasbah 5y agoMine are fd [0] to replace `find` and tldr [1] to replace `man`. [0]: https://github.com/sharkdp/fd https://github.com/sharkdp/fd [1]: https://tldr.sh/ https://tldr.sh/
- jjice 5y agofd is fantastic as well, and I can get away with tldr 80% of the time before diving into man.
- mananaysiempre 5y agoHave you looked at the original man pages for 7th ed. (http://man.cat-v.org/unix_7th http://man.cat-v.org/unix_7th) or Plan 9 (http://man.cat-v.org/plan_9_3rd_ed http://man.cat-v.org/plan_9_3rd_ed)? They’re basically tldr with less examples, and exhaustive, except there’s so much less stuff to exhaust. I was both pleasantly surprised by how simple they are and unpleasantly surprised by how far we’ve fallen in terms of complexity (though my recent comment https://news.ycombinator.com/item?id=27498189 https://news.ycombinator.com/item?id=27498189 explains why that’s an oversimplification). The GNU man pages (where they even exist) or the POSIX ones are a usability abomination in comparison. Even BSD’s are still quite bad.
- papaf 5y agoI find repgrep defaults sensible when searching for text but fd misses files that I expect it to find -- this has happened a few times now and I have gone back to find. For instance: 'fd .apk' to search for android builds.
- mananaysiempre 5y agoUnlike find, fd follows the rg approach of respecting VCS ignores, which does have both advantages and disadvantages. But if you know you’re specifically searching for a binary, just pass -u (once to include VCS-ignored files, or even twice to also include hidden ones) and you’re golden. In your specific example you probably also want -F (fixed string) or -g (glob), because fd does regexes by default and I doubt you want to type '\.apk'. As to find, its flexibility certainly comes handy on occasion, but... find: paths must precede expression Aaaargh.
- virgoerns 5y agoI like cheat.sh as the alternative for tldr which doesn't need to be installed as all, because it can be used with curl: $ curl cheat.sh/tar
- jjice 5y agofzf is another that is just absurdly powerful. fzf comes in handy in so many useful little scripts for me.
- thiht 5y agoWhat do you use fzf for? I can't figure out a use case for it but everyone seems to love it, what am I missing on?
- taude 5y agoHere's an example with rip grep. Say you search for something with a lot of results, you can feed the results with a lot of answers into it, and then add additional filters. Useful for when you're not "exactly" sure what your search term needs to be. I use it when ripgrepping a lot of code bases all at once.... I also have a folder of a bunch of curl commands that I can search and apply fuzzy finding on the results that helps me explore to find. Contrived example, search for "t" in all these files and then pipe to fzf: rg t . | fzf
- lelandbatey 5y agoThe main thing I get out of it is super amazing fuzzy-search of my terminal history. Normally with bash's built in CTRL-R reverse history search, you pretty much have to know EXACTLY what you're searching for, and if there are a lot of similar commands between the most recently run match for a search and the one you're ACTUALLY searching for, you may have a really hard time finding it since you have to go backwards through the commands one at a time. For myself and many people, we were getting really good at typing `history | grep '<regex>'`, maybe with more pipes to grep for further refinement. But with fzf[1], that whole workflow of searching through your history is probably two orders of magnitude faster. Now you hit CTRL-R and you start typing any random part of the command you're trying to remember. If there was some other part of the command you remember, hit space and type that search term after the first search term. FZF will then show you the last 10-ish matches for all the search params you just typed, AND it will have done all this with no UI lag, no hitching, and lightning fast. I don't know what other people use FZF for, as this is the SINGLE feature that's so good I can't live without it anymore. [1] - https://github.com/junegunn/fzf#key-bindings-for-command-line https://github.com/junegunn/fzf#key-bindings-for-command-lin...
- kibwen 5y agoSee also delta for diffing (and as a drop-in replacement for git diff) and exa for ls. https://github.com/dandavison/delta https://github.com/dandavison/delta https://github.com/ogham/exa https://github.com/ogham/exa
- RBerenguel 5y agoYes, I have it enabled as git's diff. I have tried exa but didn't see much difference. Anything remarkable I may be missing from exa?
- revscat 5y agoIt has a flag to add a “Git” column to the output, showing the status of each file in the listing (new/modified/etc.) it also has a `—tree` flag which does exactly what you think it does. This let me remove my old `tree` command and consolidate into one.
- ibraheemdev 5y agoYep, I've also been loving mcfly, bat, and fd. I mentioned this further down in the post, but I compiled a list of all these modern unix tools a couple months ago: https://github.com/ibraheemdev/modern-unix https://github.com/ibraheemdev/modern-unix
- geoelectric 5y agoThis compilation is very useful. I've been needing to review my CLI toolkit for a bit, and this looks like it'll make it easy for me to try out some alternatives. Thank you for putting the time and energy in to create it.
- bewuethr 5y agoI bumped into three blog posts a while ago that listed similar modern alternatives – lots of overlap: https://darrenburns.net/posts/tools/ https://darrenburns.net/posts/tools/ https://darrenburns.net/posts/more-tools https://darrenburns.net/posts/more-tools https://darrenburns.net/posts/even-more-tools https://darrenburns.net/posts/even-more-tools
- Y_Y 5y agoJust what I've been looking for! Thanks for making this. I'd love to see someone build a "new" userland with all the old gnu tools replaced where there's a good modern alternative.
- tuananh 5y agolove it. very easy to understand what the tool can do :)
- majkinetor 5y agoAwesome list. Double awesome that almost all tools are cross-platform.
- bmn__ 5y agohttps://altbox.dev https://altbox.dev
- 5y ago
- mananaysiempre 5y agoI’ve mixed feelings about rg in exactly this respect. On one hand, it’s awesome. It’s both excellent from a programmer’s standpoint and indispensable from a user’s standpoint. It’s just so neat it’s hard not to love it. A remote interviewer thought I just had a custom alias for grep -r and it was hard not to laugh and share the joy and relief that I didn’t. On the other hand, it’s decidedly anti-Unix, arguably even more so than GNU utilities. The man page goes on for ages, and not because it’s written badly (it’s not), but because the tool does so much. I really wish you didn’t have to bundle all of that functionality into a monolithic binary to get this kind of performance. For reference, walking directory trees was specifically cut out of the Plan 9 userland and left for du(1) because it was stupid how many implementations of it there were. Yes, Rust’s is in a library, but then you don’t have Unix as your OS, you have Rust instead. “Every language wants to be an OS”[1]. [1]: https://wiki.c2.com/?LanguageIsAnOs https://wiki.c2.com/?LanguageIsAnOs
- burntsushi 5y agoWhile I don't think anti-Unix is a totally accurate description, there are definitely aspects of ripgrep that aren't compositional. Some of it is performance, but some of it is just about output. Its default output format to a tty is fundamentally not compositional. So I end up building stuff into ripgrep that you might otherwise achieve via pipes. I do draw a line, because it otherwise gets ridiculous. The plan9 comparison is kind of meh to be honest, because it never achieved widespread adoption. Popularity tends to beget complexity. But otherwise this isn't so surprising to me. One of the hardest parts about making code fast is figuring out where to fall on the complexity vs perf trade off. It's pretty common that faster code is more complicated code. Directory traversal is a classic example. There are naive approaches that work in most cases, and then there are approaches that work well even when you throw a directory tree that contains hundreds of thousands of entries. And then of course, once you add gitignore filtering, you really want that coupled with tree traversal for perf reasons. When you specialize, things get more complex. Then we build abstractions to simplify it and the cycle repeats. This to me seems more like a fundamental aspect of reality than even something specific to programming.
- 5y ago
- pjmlp 5y agoWhat is so new wave, when it is mostly about GNU/Linux, POSIX has hardly changed and it is basically CLI like for 50 years?
- burntsushi 5y agoIf I had to succinctly put my finger on it, I would say: it's "new wave" because it doesn't search everything by default. Of course, ripgrep wasn't the first to do that, but maybe is the first to do it while retaining competitiveness with GNU grep. Of course, what's "new wave" to one person might be "mild evolutionary step" to another. (And perhaps even "evolutionary" implies too much, because not everyone sees smart filtering by default as a good thing.)
- pjmlp 5y agoYeah, but that has nothing to do with UNIX. Kudos for your ripgrep achievements, though.
- burntsushi 5y agoI would say 90% of how ripgrep works is based on long standing Unix tooling. "Smart" filtering by default is certainly not in the Unix tradition, but to say ripgrep has nothing to do with Unix is just wrong. To be honest, I don't really know what you're after here. It is fine to say that the "new wave" is not rooted in Unix, but that doesn't mean its inaccurate to call ripgrep a Unix tool.
- pjmlp 5y agoI am after there is nothing about new wave UNIX to talk about, unless we are now supposed to start talking about Rust and ripgrep adoption at Open Group. Now that would be new wave UNIX
- burntsushi 5y agoNo, that's what you think new wave UNIX is. This strikes me as just pedantic nonsense to me. You don't need to go around policing what "new wave" is supposed to mean to everyone.