Fd and ripgrep/rg are the two "new" alternatives I use on a regular basis, and which are just huge improvements to life. Both of these find/search programs respect your .gitignore files, which helps enormously & makes searching my department's entire codebase really fast.<p>Fd is featured on Julia Evans' recent "New(ish) command line tools"[1]<p>[1] <a href="https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-line-tools/" rel="nofollow">https://jvns.ca/blog/2022/04/12/a-list-of-new-ish--command-l...</a> <a href="https://news.ycombinator.com/item?id=31009313" rel="nofollow">https://news.ycombinator.com/item?id=31009313</a> (760 points, 37d ago, 244 comments)
The singular habit I picked up way back in the day was to simply cope with what was available.<p>There's all sorts of utilities and such. Emacs was a grand example at the time as well. Lots of better mousetraps.<p>But when you bounce around to a lot of different machines, machines not necessarily in your control, "lowest common denominator" really starts to rear its ugly head.<p>That vast majority of my command line concoctions are burned into muscle memory.<p>Today, I think the base line install of modern *nixes are higher than they were back in the day, but the maxim still applies of working with what they have out of the box.
I want to love fd - I'm a big believer in the idea that CLIs don't <i>have</i> to be scary, intimidating things (see normals using Slack with /commands and keyboard shortcuts), and find has a gigantic hairball of a UI.<p>The thing is, though, I know find well enough to not notice the terrible UI that much, and I know I can rely on it being everywhere. With fd that isn't true.<p>So it's hard for me to justify making the move.<p>Same thing happens with things like the fish and oil shells - I have little doubt their UX is better than Bash's, but Bash is pretty ubiquitous.<p>Emacs has this problem too, as an Emacs user. The UX is completely alien by current standards, but if you update the defaults you'll break a lot of people's existing configs.<p>How do you get around backwards compatibility / universality UX roadblocks like this?
It feels like we're in a third wave of innovation in Unix CLI tools. The first was from BSD in the late 70s/early 80s which considerably improved the original Unix utilities, then the GNU tools rewrite in the late 80s, then there were the dark ages of System V. I give ack (and Andy) credit for starting this latest wave around 2005 but it's really taken off lately with tools being rewritten in Rust and challenging the old status quo.
I love fd, but somehow I always get tripped up on this:<p><pre><code> fd # prints tree of current directory
fd somedir/ # results in an error
find # prints tree of current directory
find somedir/ # prints tree of somedir/</code></pre>
I like the contemporary alternative to the classics. They make a lot of thing so much easier.<p>I have a little mental block, though. It's related to the realities of the stuff I work on. Since I find myself logged into other people systems, keeping the old, standard tools hot in my head does really take some of the load off. It's a pretty common refrain, but it's real and practical when you've got embedded systems, bsds, linuxes, macs, etc. Even the difference between gnu and mac is clunky when I don't practice enough.<p>For the same reason, with the notable exception of git, I use practically no aliases.<p>If I could invent a product, maybe it would be one that enables effectively "forwarding" CLIs to a remote host shell.
Maybe I’m just old fashioned but all these new command line utilities strike me as solutions in search of a problem.<p>Standard ‘find’ works great. It finds files. It can filter by any criteria I have ever had to look for and the syntax seems very intuitive to me (maybe I am just used to it). It is flexible and powerful.<p>I’d love to be told I’m wrong, because I feel like I’m missing something.
One thing to remember is that these fun utils won't exist on production servers. You also don't want them there for obvious reasons. I find it better to use the most commonly available set of unix tools and I end up being far more effective due to that.
Hmm, I already have a shell alias that does 90% of this. Doesn't parse .gitignore, but it's not a big problem for me. If it was I'd do `make clean` in the project.<p>This is always installed and ready to go on any box I have my dotfiles.<p>I suppose that is why it is hard for these perfectly-good improvements have a hard time getting traction. Because the older stuff is still so flexible.
That are a lot of dependencies for such a simple tool. I'm a Rust user myself, but some of those dependencies really should be part of a good standard lib. Actually, the NPM like ecosystem is my biggest pain point with Rust.<p>[dependencies]<p>ansi_term = "0.12"<p>atty = "0.2"<p>ignore = "0.4.3"<p>num_cpus = "1.13"<p>regex = "1.5.5"<p>regex-syntax = "0.6"<p>ctrlc = "3.2"<p>humantime = "2.1"<p>lscolors = "0.9"<p>globset = "0.4"<p>anyhow = "1.0"<p>dirs-next = "2.0"<p>normpath = "0.3.2"<p>chrono = "0.4"<p>once_cell = "1.10.0"<p>[dependencies.clap]<p>version = "3.1"<p>features = ["suggestions", "color", "wrap_help", "cargo",
"unstable-grouped"]
I use find all the time, but it is such a strange beast - it's as if there were a meeting among all the standard Unix utilities on look and feel and find missed the memo. But it's ubiquitous and I'm too old to change horses now anyway.
Hey, fd. I don't use it normally, but it ended up being the easiest and fastest tool for me to delete ~100 million empty files off my disk (a weird situation). It has threading and command execution built in, so I could saturate my cpu pretty easily doing the deletes with `fd -tf --threads=64 --exec r m {}` (I put the space in the rm command on purpose for posting).
I don't use `fd` on the command line because I have very ingrained `find` muscle memory, but it's really made using `projectile-find-file` in Emacs totally usable with the huge monorepos I deal with at work. The same goes for `rg`, I love using it with `consult-ripgrep` in Emacs for searching through mountains of code.
> The command name is 50% shorter* than find :-).<p>I love this but if enough new tools keep doing this I might have to change some of my bash aliases :(
I use fd and rg a lot, integrated them with my scripts and even have some of them bound to keys.<p>Insanely good and fast programs. Zero regrets.<p>For a fuzzy finder I recently replaced fzf with peco. I like it better, it's very customizable.
I'm seriously curious, is this the first time this link is being submitted?<p>Frequently, I try to submit a link, and it shows up as having been submitted. And I'm quite certain a tool as popular as fd has been featured on hn before. So either, somehow this particular link has never been submitted (doubtful), hn allows resubmitting a link after some amount of time, or the link resubmit prevention logic doesn't apply to certain users?
Usually when I can't be bothered to remind myself the syntax for find, my go to these days is `echo **/*pattern*`. Of course, this is mainly just for small searches.
I would love a `find` with reverse polish notation, also known as postfix notation. Something like:<p><pre><code> find . --name this --name that --or
</code></pre>
or, for more complex:<p><pre><code> find . --name this --name that --or --modified 2022-05-20 --and
</code></pre>
I have some little personal CRUD apps and this sort of postfix notation works very well for them.<p>I could write something like this but haven't gotten motivated to do it though.
Windows test comparison on my machine - for finding all .jpg in my D: drive<p>1 - classic command prompt: "D:\>dir /s /b *.jpg > 2.txt" - time 5 seconds (4581 files)<p>2 - this little gizmo: "D:\>fd -e jpg > 1.txt" - time 1 second (same 4581 files)<p>Conclusion: I have a new tool dropped in my System32 folder from now on. Thank you David Peter
This didn't really sound like something I need until I got to the `{.}` syntax, which solves a problem I was just trying and failing to solve with gnu find ten minutes ago (namely that there seems to be no convenient way to use the basename of the match in an exec statement, eg. bash's `${file##*.}` syntax).
Well this is saving me a ton of time as I'm basically migrating UID ownership of files for NFS shares that dates back to the 90's. According to my rough benchmarks between find and fd, fd is ~3 times faster.
See this for a collection of alternatives for a modern unix commands. <a href="https://github.com/ibraheemdev/modern-unix" rel="nofollow">https://github.com/ibraheemdev/modern-unix</a>
Haven't there been unresolved security issues with chrono, a crate this one depends on?<p>Chrono hasn't been updated for almost 2 years. Is the issue resolved or is there a security risk in using fd?
How does it run faster than find? Can I manually implement that speedup using standard unix tools? I need to run find a lot on many machines I don't have access to install anything on.
Would it make sense to create a utils package with all these new rust based utilities? Something like "rustutils" with a resemblance to "coreutils".
There are some Unix tools I never get around to memorizing the syntax of, and always end up searching "how to"s. find is definitively one of them.
I don't like find. Nor do I like vi (not vim, vi) and/or maybe others. I don't wish to stamp on someone's parade who's more accomplished than I am. But I think these "new" tools miss the point.<p>I use vi because I know it exists on every(?) system ever. It's not like I go out of my way seeking vi. I feel the feeling is similar for find. It works. It works well. It works the same on all systems I work on.<p>Would I go out of my way to install find on my system? Probably not.