Live data from Hacker News

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

joeyh.name

51–60 of 225 posts

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

#51
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.

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

#52

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.

cd cannot be an external command in Unix-like systems, it has to be a shell built-in.

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

#53

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.

cd cannot be an external command in Unix-like systems, it has to be a shell built-in.

It could have been a script for adding to shell startup files.

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

#54

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…

Couldn't you just alias the find command mentioned in the SO thread?

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

#55

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.

I think that's the default behaviour in Zsh or Fish if you press tab.

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

#56

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.

cd cannot be an external command in Unix-like systems, it has to be a shell built-in.

But cd can be invoked from a shell function (which doesn't create a subshell).

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

#57

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.

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

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

#58
post #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?

The output is different between find and ls when you run it on another directory.

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

#59

Earlier quoted context omitted.

I'll bite: Why?

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/

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

#60
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 me…

Exactly, I can telnet into my shitty Chinese router and still have cat and sh
Post reply on HN