Live data from Hacker News

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

joeyh.name

41–50 of 225 posts

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

#41
post #31

There's a few programs I wish were standard on all Unix systems by now: * tree - print directory structure * bat - cat, but actually designed for reading files. Syntax highlighting, line numbers, automatic paging. * rg - better grep * direnv - local environment variables

One of the reasons is Rust, but another reason is that the standard shied away from adding anything with frills because UNIX-likes run on all kinds of systems, many which don’t have space for this. There is a reason why something as seemingly ubiquitous as bash or vim are not available everywhere (but sh and vi are). The base set of utilities is really “do more with less” and the ability to keep to this philosophy means that I can connect to a router with 2 MB of MMC storage and still be able to have an extremely functional base set of tools, rather than having some arbitrary subset of the standard utilities because they just can’t be supported on platforms like that.

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

#43
post #3

> sponge Why not use > file? > mispipe In bash there's PIPESTATUS for that.

I think this is a good question as moreutils doesn’t do a very clear job of explaining it.

Sponge lets you do a series of piped transformations on 1 or more files and overwrite the result back to the original files.

Using > things will just break.

I’m guessing this also means you can’t pipe something bigger than what your memory can hold.

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

#44
I wish there was a short and simple command for “list all files of a directory and no subdirectories“. ls doesn’t seem to have a switch for that kind of functionality.

It’s discussed on stack-overflow. [0]

Someone even wrote a nodejs tool for this functionality [1], but I would rather have something written in a compiled language.

[0]: https://stackoverflow.com/questions/10574794/how-to-list-onl...

[1]: https://github.com/mklement0/fls

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

#45
post #31

There's a few programs I wish were standard on all Unix systems by now: * tree - print directory structure * bat - cat, but actually designed for reading files. Syntax highlighting, line numbers, automatic paging. * rg - better grep * direnv - local environment variables

Good list of things you can install to better your CLI experience, but I am not sure if I agree that they fill out missing features. Why is bat better than less? I admit to catting files for reading as much as the next guy, but I almost always have the tiniest regret that I didn’t feed it into less and kept my terminal cleaner. As for RG and AG. other than being faster, how are they better? I thought they were api co…

> As for RG and AG I thought they were api complainant drop-in replacements

To grep? Not that I know, I don't think either respects POSIX grep to say nothing of GNU grep. Though the trivial usage is identical, and many basic options carry over (e.g. -C and friends).

> other than being faster, how are they better?

Way better defaults for one. `rg` defaults to being recursive, ignoring binary files, respecting various types of ignore files, not being limited to BREs, coloring, …

They also have useful convenience features like "file categories" (e.g. `-t` will expand to a bunch of predefined include glob patterns so you don't have to input them by hand, which can be tedious), or parallelism (recursive ripgrep will parallelise searches across files, with grep you have to remember to combine `find`, `xargs -P` and `grep` for that to happen).

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

#46

I wish there was a short and simple command for “list all files of a directory and no subdirectories“. ls doesn’t seem to have a switch for that kind of functionality. It’s discussed on stack-overflow. [0] Someone even wrote a nodejs tool for this functionality [1], but I would rather have something written in a compiled language. [0]: https://stackoverflow.com/questions/10574794/how-to-list-onl... [1]: https://githu…

But the top answer has it:

> find . -maxdepth 1 -type f

A little clunky, but there's certainly no need to mess about in JavaScript land. If you use it often, create a shell macro.

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

#48

I wish there was a short and simple command for “list all files of a directory and no subdirectories“. ls doesn’t seem to have a switch for that kind of functionality. It’s discussed on stack-overflow. [0] Someone even wrote a nodejs tool for this functionality [1], but I would rather have something written in a compiled language. [0]: https://stackoverflow.com/questions/10574794/how-to-list-onl... [1]: https://githu…

ls *(.) if you use zsh.

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

#49

I wish there was a short and simple command for “list all files of a directory and no subdirectories“. ls doesn’t seem to have a switch for that kind of functionality. It’s discussed on stack-overflow. [0] Someone even wrote a nodejs tool for this functionality [1], but I would rather have something written in a compiled language. [0]: https://stackoverflow.com/questions/10574794/how-to-list-onl... [1]: https://githu…

Just curious, how is `find . -maxdepth 1 -type f` not simple?

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

#50
Where is Msdos utility "ncd"? It was like "cd" but guessed from few character hint where you wanted to go. If the choice was not immediately obvious if offered a menu or a tree. I shortened it to "n". -- There was some linux utility but setting it up was annoyingly tedious, with lots of useless and cryptic options.
Post reply on HN