Live data from Hacker News

Moreutils – Unix tools that nobody thought to write (2012)

joeyh.name

71–80 of 225 posts

Re: Moreutils – Unix tools that nobody thought to write (2012)

#71

Earlier quoted context omitted.

Check out renameutils[1], which has the advantage over vidir of doing sanity checks before renaming. Also, this can be done in emacs using wdired. [1] - http://www.nongnu.org/renameutils/

The ranger file manager also has this built in.

Was about to point this out, but it's good to know if you ssh in a box which doesn't have Python installed.

Edit: Or use a more portable terminal FM, nnn pops to my mind

Re: Moreutils – Unix tools that nobody thought to write (2012)

#72

Earlier quoted context omitted.

Rust is designed for a fairly small number of relatively modern systems; there are many close-to-POSIX systems that can’t (and I would guess likely will never) be able to run Rust code in any formal capacity. To the hopeful: even C++ has been unable to win here, despite having many more years of a head start and much more accommodation for stranger platforms. It’s just not going to happen.

What kind of platforms are you thinking of? People have got Rust running on the Raspberry Pi. https://old.reddit.com/r/rust/comments/cdcads/

Rust supports many platforms but only has "tier 1 support" on a handful of mainstream architectures.

https://doc.rust-lang.org/nightly/rustc/platform-support.htm...

Re: Moreutils – Unix tools that nobody thought to write (2012)

#73

Earlier quoted context omitted.

What kind of platforms are you thinking of? People have got Rust running on the Raspberry Pi. https://old.reddit.com/r/rust/comments/cdcads/

Linux on ARM is a very mainstream platform from the perspective I’m looking at this from, I’m afraid. I’m talking about strange Unices running on architectures that GCC may or may not maintain a backend for, or maybe a BusyBox available on some debug interface, maybe a school project to build a simple POSIX-compatible OS or a bootstrap for a platform that had been recently jailbroken. In these cases C is almost alway…

Could you give some actual examples? This sounds interesting but I'm not sure I've ever seen something like that in the wild.

Re: Moreutils – Unix tools that nobody thought to write (2012)

#74
post #62

Earlier quoted context omitted.

find doesn't return the same output as ls when run on another directory. Maybe there is a switch to do this? I'm not sure. $ mkdir -p tmp && touch tmp/a tmp/b tmp/c $ find ./tmp -maxdepth 1 -type f ./tmp/a ./tmp/c ./tmp/b $ ls -1 ./tmp a b c

The -ls flag to find prints the same as ls

not quite.

from the man page:

> The format is identical to that produced by ``ls -dgils''.

Re: Moreutils – Unix tools that nobody thought to write (2012)

#75
post #15

Nice collection of quite useful tools. Some of these can be easily replicated by using a more modern shell (bash, zsh) like mispipe, others are just shortcuts (e.g. ifne, chronic). But what immediately stood out to me is `vidir`. I really like the idea of editing file names with an editor. Using loops and regex in a shell for mass renaming can be a mess. It should be way easier with `vim`. This tool made me install m…

I use Emacs shell-mode for most of my terminals, which allows navigating and editing the buffer just like any other file. I'll often make several copies of a command, then use a macro to alter each one; after checking that they look right, pressing Enter will send them all to the shell.

I always tried to use the shell with emacs (eshell, multi-term) but it didn't render correctly curses and all the fancy stuffs like emojis. Out of curiosity, how do you manage that?

Re: Moreutils – Unix tools that nobody thought to write (2012)

#76
post #69

Earlier quoted context omitted.

find doesn't return the same output as ls when run on another directory. Maybe there is a switch to do this? I'm not sure. $ mkdir -p tmp && touch tmp/a tmp/b tmp/c $ find ./tmp -maxdepth 1 -type f ./tmp/a ./tmp/c ./tmp/b $ ls -1 ./tmp a b c

I think this is what you are looking for $ find ./tmp -maxdepth 1 -type f -printf '%f\n'

I'm on MacOS... :-/

   $ find ./tmp -maxdepth 1 -type f -printf '%f\n'
   find: -printf: unknown primary or operator

Re: Moreutils – Unix tools that nobody thought to write (2012)

#77

Earlier quoted context omitted.

Rust is designed for a fairly small number of relatively modern systems; there are many close-to-POSIX systems that can’t (and I would guess likely will never) be able to run Rust code in any formal capacity. To the hopeful: even C++ has been unable to win here, despite having many more years of a head start and much more accommodation for stranger platforms. It’s just not going to happen.

What kind of platforms are you thinking of? People have got Rust running on the Raspberry Pi. https://old.reddit.com/r/rust/comments/cdcads/

MIPS and SPARC to name a few. Almost all routers are on MIPS and most of them are running some form of Linux or BSD.

AFAIK, rust is still marked as "guaranteed to build" on these platforms, but assume only Linux. BSDs, not so much.

Re: Moreutils – Unix tools that nobody thought to write (2012)

#78
post #15

Nice collection of quite useful tools. Some of these can be easily replicated by using a more modern shell (bash, zsh) like mispipe, others are just shortcuts (e.g. ifne, chronic). But what immediately stood out to me is `vidir`. I really like the idea of editing file names with an editor. Using loops and regex in a shell for mass renaming can be a mess. It should be way easier with `vim`. This tool made me install m…

It's one of the reasons I like using the nnn file manager. It has a batch rename feature with exactly that functionality.

+1 for the powerful yet minimalistic nnn where concise help is only a question mark away and the default mnemonics make sense. Wonderful piece of software.

Re: Moreutils – Unix tools that nobody thought to write (2012)

#79
post #69

Earlier quoted context omitted.

I think this is what you are looking for $ find ./tmp -maxdepth 1 -type f -printf '%f\n'

I'm on MacOS... :-/ $ find ./tmp -maxdepth 1 -type f -printf '%f\n' find: -printf: unknown primary or operator

If you use brew or macports you can install the coreutils package and then you're good to go with gnu find.

I also use MacOS and I have setup the gnu userland on my local so it matches the linux environment on our servers and containers.

Re: Moreutils – Unix tools that nobody thought to write (2012)

#80

Earlier quoted context omitted.

A Rust program being standard on all UNIX systems.

I'll bite: Why?

The Debian ripgrep binary is 5.1MB. That would consume over 15% of a 32MB flash, which is the common constraint you have to work with in many (actually, discounting Android, it might even be most) Linux deployments.
Post reply on HN