Live data from Hacker News

New(ish) command line tools

jvns.ca

181–190 of 252 posts

Re: New(ish) command line tools

#183

It's not new but I like "Miller": > Miller is a command-line tool for querying, shaping, and reformatting data files in various formats including CSV, TSV, JSON, and JSON Lines. https://miller.readthedocs.io/en/latest/

I got very excited about this tool. It's exactly what I need. I wrote a custom calendar app in it. But I got disappointed by performance. A list of 10 items takes 3 seconds to draw. I yet have to check if that is not caused by some other tool in the call stack. I wonder what is others people experience with performance of mlr?

I also use regularly miller/mlr with files having 1M+ lines and I never had problems with the hardcoded processing (i.e. "verbs") nor the DSL language which is know to be much less efficient compared to verbs.

Both visidata and miller are essential tools to process/view CSV/TSV files, way better than LibreOffice or Excel in terms of performance on large files.

Re: New(ish) command line tools

#184

None of the "replacements" interest me. When I try the "new" ones I cannot get interested in them either. When trying new programs I am looking for whether a program can do something essential that I cannot do myself, e.g., with shell scripts. However I am beginning to think another reason is that these "new" utilities are consitently too complicated, e.g., too many options. It often seems as if the authors are tryin…

> Someone once said the best interface is no interface.

Was this from an article by Golden Krishna, later turned into a book by the same title?

Archived article (or, how to open your car door in 13 steps): https://web.archive.org/web/20120831083217/http://www.cooper...

Previous HN discussions:

https://news.ycombinator.com/item?id=4616945 (2012, 87 comments)

https://news.ycombinator.com/item?id=4454004 (2012, 34 comments)

https://news.ycombinator.com/item?id=4959406 (2012, 91 comments)

https://news.ycombinator.com/item?id=9218686 (2015, 56 comments, about the book)

EDIT:

One of the old comments also addressed Unix tools more directly, referring to djb's work:

https://news.ycombinator.com/item?id=4456795

What are some relevant writings by djb on user interfaces?

Re: New(ish) command line tools

#185

Earlier quoted context omitted.

fzf is a wonderful little tool. I use this script so much: git branch | fzf | xargs git checkout

Excuse my ignorance, but what does this command do?

It pipes a list of available git branches into fzf, which lets you filter them by fuzzy string match. When you hit enter, it will take the best matching one and switch to that branch

Re: New(ish) command line tools

#186
post #175
post #14

I'm a big fan of jo[1] for making generating JSON from the shell not terrible. [1] https://github.com/jpmens/jo

You could give jq a go: https://stedolan.github.io/jq/

Oh, don’t worry, I am familiar[1] with it! It doesn’t quite do this one thing as well as jo, so I like using both.

[1] https://github.com/flurie/AdventOfCode/blob/main/2021/jq/d14... - unfortunately, this is the point at which I realized the stdlib was a little too anemic for general purpose solving and gave up

Re: New(ish) command line tools

#187
post #99

macOS equivalent of locate: mdfind. This actually uses Spotlight, so it can search for files by content as well as by name. # search by content: $ mdfind some_string # search by name: $ mdfind -name my_file.txt Both commands return a list of files matching the query.

If you add this to your .zshenv or similar:

    [[ $OSTYPE =~ ^darwin.* ]] && export FZF_CTRL_T_COMMAND="mdfind -onlyin . -name ."
When you hit ctrl+t, you'll get mdfind's output for all files in the current working directory and below, auto-piped into fzf for fuzzy matching. You can do something like type "vim " then hit ctrl+t, find the file, hit enter twice to start editing it. I wrote a quick guide on installing fzf/fd/ripgrep with powerlevel10k/oh-my-zsh/zplug on MacOS, because I would get asked how to replicate my setup: https://gist.github.com/aclarknexient/0ffcb98aa262c585c49d4b...

Re: New(ish) command line tools

#188
Nice list of new tools to take a look at. However I think there's just one big drawback: as you move around different systems is very unlikely that you have those (you might even not have permission to touch those systems) so you will have to rely on the standard existing tools (even among different OSes you have slightly different implementations). That's why I lately I've investing more time reading man pages of some tools, maybe I'm missing an already existing cool feature. You can learn a ton of things from man pages, and if you follow the "SEE ALSO" section you might even learn some new commands.

Re: New(ish) command line tools

#189

My favourite non-standard tool is pv[0]. In it's simplest use case, pv is a replacement for cat that also outputs a progress bar to stderr. You can use it to add a progress bar (or multiple) to just about any pipeline. I love it because I know if the one-liner I wrote is about to finish in a couple minutes or if it will be a while and I should either write something more efficient, or do something else while I'm wait…

From the PV man page (https://linux.die.net/man/1/pv)

> A more complicated example using numeric output to feed into the dialog(1)

> program for a full-screen progress display: ...

> Frequent use of this third form is not recommended as it may cause the programmer to overheat.

^- is that a wisecrack hidden in an otherwise serious man page?

Re: New(ish) command line tools

#190

I really like the approach of pipe-rename ( https://github.com/marcusbuffett/pipe-rename ) for renaming many files. It's especially convenient for people who can efficiently edit many lines in their favorite text editor (so everybody here, I guess). Main problem: you maybe don't do this kind of operation frequently enough to remember how it's called or how you aliased it.

Some time ago I have in fact written a small utility based on fzf that solves this problem by letting you comment aliases in your shell config file and fuzzy-search through them: https://github.com/nmaggioni/wat The tag system is especially useful to me when I know the general concept I'm after but don't remember the exact wording of the command.

From a quick look I love it! I just wish something like that was part of my shell and it not only applied to aliases... :)
Post reply on HN