Live data from Hacker News

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

joeyh.name

111–120 of 225 posts

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

#111
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'

Not got a shell handy, but "-exec ls"?

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

#112
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

>cat, but actually designed for reading files. Syntax highlighting, line numbers, automatic paging. //

`less` not good enough?

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

#113
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…

> I thought they were api complainant drop-in replacements so it’s not like they fill in a missing role.

Could you please let me know how you came to that understanding? Because I'd really like to fix it. ripgrep was never intended to be POSIX compatible. It would have been a straight-jacket over its functionality. See: https://github.com/BurntSushi/ripgrep/blob/master/FAQ.md#pos...

> As for RG and AG. other than being faster, how are they better?

For ripgrep at least, a lot of it comes down to speed, better output formatting by default and suppressing results you probably don't want by default (but that can be turned off quite easily).

But there are other features, like better Unicode support, built-in support for searching compressed files, support for file types and a few other things. The README includes a bit more. ;-)

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

#115
post #55

Earlier quoted context omitted.

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

Probably immediate subdir. What I am talking about is universal jump-to-anywhere. Like I have subdir "/media/tnoko/sdc1/capture/Roinaa/". "ncd Roi" should be totally sufficient and unique command to go there.

Notably for this there's autojump[0], z[1] and fasd[2]. More work than an efficient script for sure, but more fancy options around it all. Autojump works pretty well with zsh (and before that with fish) for me.

[0] https://github.com/wting/autojump

[1] https://github.com/rupa/z

[2] https://github.com/clvv/fasd

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

#116
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

find -type f -d 1

Works for me on OSX.

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

#117

The sponge example: sed "s/root/toor/" /etc/passwd | grep -v joey | sponge /etc/passwd I think it can be rewritten as: sed -n '/joey/! s/root/toor/p' -i /etc/passwd

Yes, but -i on sed is specific to GNU, I don't think it exists on BSD/OSX/busybox

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

#118
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

>cat, but actually designed for reading files. Syntax highlighting, line numbers, automatic paging. // `less` not good enough?

I’ve never seen syntax highlighting in “less”.

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

#120

Earlier quoted context omitted.

>cat, but actually designed for reading files. Syntax highlighting, line numbers, automatic paging. // `less` not good enough?

I’ve never seen syntax highlighting in “less”.

Ha! Here’s how to have syntax highlighting while using less: https://superuser.com/questions/71588/how-to-syntax-highligh...
Post reply on HN