7 ms·
Common *nix commands written in Rust
- platinumrad 6y agoThere are sometimes good reasons, usually related to features although sometimes related to performance, to prefer newer utilities like ripgrep over older ones like grep. Implementation language is not one of them.
- throwaway_pdp09 6y agoI came here to ask, thought not outright say, what is it with all the "... in rust" stuff that keeps getting posted. It's starting to feel more like a marketing exercise than anything actually software related (happy to be corrected on this though).
- monocasa 6y agoI think it's just that Rust brings a fairly new set of semantics to system code (memory safe, but no GC), and people are pretty excited to rethink large parts of the software stack we all depend on.
- mhh__ 6y agoThat's but rust has been a known quantity for 5(?) years at least now?
- johnny22 6y agoknown to who though? I just told a long time C++ dev about Rust during a discussion about programming languages. He'd never heard of it before, and was quite interested. There are still quite a few folks out there who don't know about Rust, Go, or anything else that's gotten popular over the past few years here.
- monocasa 6y agoChanges in the systems development space take a long time to propagate. A year or so back I found out that I got passed over for an embedded job because I had a big emphasis for Rust on my side projects and they thought it was a toy GCed language and a weird anachronism to put on there.
- littlestymaar 6y ago“marketing” is probably not the right word since there is no money backing it, and it's not a concerted effort either. “Fashion” would fit better I think. Rust has long been something intellectually interesting (solving memory issues found in C and C++, while keeping their low level and with equal performance is quite a feat), but it recently started to become affordable to use (libraries are maturing, there's tons of quality learning material, and even the language itself reached a level of polish that was simply not here before), then many people who have had it somewhere on their radar for a while took the leap, and now share their enthusiasm. And the interested ones who are still waiting for a good occasion to learn it upvote and then it ends up on the front page. And now, you get this kind of low-quality content, which is merely surfing on the trend to get some clicks. This kind of things happened with Go a few years back, or with node before that, such is the fashion life of the programming world.
- dragonsh 6y agoRust solve memory issues of C/C++ at the cost of simplicity and with convoluted, complicated syntax. It will bring in new class of bugs when it becomes popular enough and when large parts of Firefox are rewritten in it. I am not sure why some programmers think, complex and convoluted the syntax, the better the language, especially taking rust as an example. Go has been successful in it’s niche as systems programming language because it’s syntax is easy and can fit the brain easily. A similar simple good programming language I see is zig language which makes memory safety as a choice for the programmer to implement rather than forcing on them with complex borrow checker syntax. On top rely of unsafe C library and code to do anything useful. Zig eschews complexity and embraces C with simple syntax and semantics and provide easy tools to build memory safe code and not shoot the foot. But anyways like democracy in programming complicated languages can win due to majority by marketing or in fashion.
- monocasa 6y agoZig and golang aren't solving the same problem as rust. Zig isn't memory safe, and golang achieves memory safety with the help of a GC.
- infraredcabbage 6y agoConsider this. If a program is written in Python, and becomes popular, it is usually a matter of time before it gets rewritten in, and replaced by an implementation in a faster language. There are fast implementations (C) and there are somewhat safe implementations (Python, Java, ...). If I were to place Rust in this hierarcy - it is both fast AND safe, and there's rarely a good reason to replace it, so you've software that's already at the top of the hierarcy. This means that the particular implementation is likely to be the one that doesn't get replaced. "...in Rust" has a lot of implications other than being an exercise in marketing.
- platinumrad 6y agoSo why not write "fast and safe implementations of popular command line utilities" rather than focusing on the implementation language? If there were a safe and fast implementation of, for example, find in Ada why should it be excluded from this list?
- infraredcabbage 6y agoI don't see any reason why people who write these tools in Ada shouldn't add that to the headline as well. People who are interested in Ada would be even more likely to read the article then.
- pdimitar 6y agoWriting fast and safe implementations of popular CLI utilities is already happening. There's also some advocacy involved which many people obviously find distasteful. To me it's a bonus though: tell me why your tech choice makes a difference, I'll check and maybe learn it. Anything wrong what that?
- johnklos 6y agoExcept Rust isn't a direct replacement for c. Rust's system requirements are perhaps acceptable for what'll be normal in computers five years from now. We don't need to re-stratify development so that only people with expensive computers with > 4 gigs of memory can compile what they run.
- yjftsjthsd-h 6y agoI assume it's just waves of popularity and people getting into particular ecosystems. A few years ago there was a similar wave of writing/rewriting software in go.
- ggm 6y agoIf the language is strongly typed and reduces opportunistic threats of mis-application or unexpected data, I'd consider that an upside. If the compiler targets multi-cores and the language helps express implicit parallelism or asynchronous code possibilities which map to multi core, better than the original language, then thats net beneficial too. If the language encourages coding patterns which are extensible or re-usable, then its possible the runtime code state gets smaller as increased use of shared code patterns leads in the longer term to more COW shared libraries.
- platinumrad 6y agoOkay, so why not say "safer utilities" or "more performant utilities" rather than focusing on the implementation language? If I'm an end user of a safe and performant utility why should I care if it's written in Rust, Go, or OCaml?
- infraredcabbage 6y agoBecause there are a lot of programmers that read Hacker News and some of them have interests in particular things. That's why you see titles such as "Learn polynomial regression with Tensorflow" or "How do do HFT with Python".
- pdimitar 6y agoBut why do you care when it's said that it's written in language X? Does that ruin the story for you? And the potential usefulness of the tool?
- nine_k 6y agoThe implementation language may be important if it promotes (and, with certain discipllne, guarantees) a lack of memory-access errors and a lack of data races. This may be not as important in a replacement for `less` or `du` than in a HTTP or SMTP daemon, but still.
- pornel 6y agoAll things being equal, implementation language shouldn't matter. But they aren't equal — different languages have different trade-offs and this affects programs they produce. A fantastic `ls` implementation in Java would not be very practical. OTOH it's not an accident that Rusty replacements of these programs tend to be multi-threaded, because that's a thing Rust encourages and makes practical.
- burfog 6y agoFrom the ls replacement: "Why spend your time squinting at black and white text?" Uh, because squinting at blue-on-black text is much more difficult. Human eyes focus best at yellow-green, they see that as brightest, and they don't even have long-wavelength (blue) receptors in the fovea. I also looked at the alternatives to ps, top, cat, find, and du. My overall feeling is that these are really not like UNIX tools at all. They are not very scriptable. Output is full of Unicode, color, column dividers, headers, underlining, and pagination. Values are in so-called "human readable" form, like "1.4M" instead of 1474560 or whatever it may be, which is a real pain for scripting. I also notice some features that seem out of place to me, a long-time UNIX user. The tools waste space on displaying things related to git, docker, and network connections. I would expect the proper tools to be more like "git ls", "docker ls", "docker ps", and "netstat -p". (for those ones that don't actually exist, take that as a suggestion for a coding project) Not all the world is devops on a web site.
- ReactiveJelly 6y agoMy distro's ls already does coloring by default. It turns it off somehow if it detects the output is a pipe, so that "ls | less" still works. It also turns off multi-column in that case, so "ls | wc -l" counts directory entries.
- boulos 6y agohttps://linux.die.net/man/3/isatty https://linux.die.net/man/3/isatty :)
- Myrmornis 6y agoThat's not fair. They typically turn off visual adornments when the output is not a tty, thus automatically supporting consumption by both human eyes and scripts.
- nine_k 6y agoI think you made a typo; long-wavelength is red, and blue is short wavelength.
- merlinsbrain 6y agoThis isn’t too compelling a story on its own, I’m assuming this is someone who wrote a collection for themselves and made it public on their blog. Glad they wrote their collection, but not something I’m excited about. In general I’d love to hear “this was better in Rust because of X, Y and Z and the tradeoffs I had to make were A, B and C”. But again, this isn’t on the author to do, I’m pretty sure I can find other articles on the internet that talk to that. Edit: most of the READMEs of the projects look pretty good about that on a quick skim.
- nailer 6y agonushell is a better idea though - structured output, no text scraping. And it's Rust! https://www.nushell.sh/ https://www.nushell.sh/
- gigatexal 6y agoYes this I think should be the future direction shells go
- harikb 6y agoWhat I would like to see is something like Hadoop, Kafka, Spark rewritten in Rust. Something that will fundamentally change the landscape. Rewriting these Unix cli is only good learning experience
- pdimitar 6y agoMaybe, but consider that security vulnerabilities have been found in SSH and `sudo` / `su`, several times the last few years (and they are not the only UNIX tools, it was just the noisiest news about such vulnerabilities). Any new programming tech that avoids my SSHD letting anyone get in because of this or that is very welcome by me. There's Sonic, which is a searching software, although not on the level of ElasticSearch. People are working hard to bring more safety to widely used technologies, every day, we just don't hear much about it.
- nine_k 6y agoIt's a nice collection of common CLI utilities that make one's life a bit more comfortable. The poster is not the author, but the collector.
- ryuukk_ 6y agothis is worst than a sect, rust is a cancer