Tag Archives: cli

CSV from the command line

There’s a whole bunch of tools out there:

miller seems to be the most versitile (that I could install without effort)

xsv also looks good.

dasel appears to be similar, but I haven’t tried it yet.

pspg looks very good.

The instructions to install csvtk are out of date (go get instead of go install)

Most of the homepages for these list others as well (tv, visidata, …)

Duff – duplicate file finder

I’ve got this folder called vast/todo/t.temp that’s got a 100 GB of stuff from old computers in it. Typically, I just copy stuff there and tell myself I’ll get back to it. There are 61,287 files, none less than a year old, and (as of now) only 5 of those 60-thousand files are less than 2 years old.

How will I ever “get back to” making sense of all that junk? Enter duff – the CLI duplicate file finder. Just say:

$ duff *.txt

and it tells you something like this:

2 files in cluster 1 (19925 bytes, digest 8b5cc01edd340e91957b54f10c22d6d3283b7962)
ccc.txt
zzz.txt

Then you decide whether you want to nuke ‘ccc.txt’ or ‘zzz.txt’. Bob’s wife’s your aunt.

Installation is just port install duff

More of those CLI Utilities

I’ve found some more CLI utilities (via this thread) that look like they’re worth further investigation.

  • Zola, a static site generator
  • fd (a/k/a fd-find), an “80% replacement” for find; see also fselect
  • xsv, a tool for working with CSV files
  • broot, another disk analysis/tree replacement
  • sd, a sed replacement
  • cw, a wc replacement
  • hors, a combination of lynx and the technical web (which I couldn’t build on my Linux system because it’s running gcc instead of clang). (Ditto ‘bat’ btw.)
  • lolcate, a locate/updatedb replacement

I’m intrigued by topgrade but a little terrified of actually using it.

And I found the indispensable utility called genact.

Rust Command-Line Utilities

I’ve been learning (or maybe beginning to learn) the Rust programming language. (It was a toss-up between that and Go, and I probably picked wrong, but I won’t know until I know a lot more than I do now.)

  • Tokei (for counting source code lines) and
  • diffr as an alternative to colordiff
  • ripgrep as an alternative to ack (etc.)
  • just as a command runner (think “make”)
  • lsd and exa as replacements for ls
  • pastel for working with colors on the command line
  • skim (not to be confused with the excellent Skim) as a fuzzy finder
  • dust, dutree, and dua-cli as replacements for du
  • bat (“better cat”) and mdcat (cat for markdown)
  • starship (prompt)

I’m only beginning to play with these. But I was surprised to see so much activity developing command line utilities. There is some misunderstanding of the Unix philosophy, but it’s understandable (cat isn’t for viewing files, but of course that’s how most of us use it). Yay open source!

Command Line Interfaces of the Future

This cracks me up: the Windows 8 server is going to nudge, and eventually force, administrators to give up their point-and-click interfaces in favor of something a little more up-to-date.

(I could have told you they’d eventually wind up here, after struggling for years with COMMAND.COM and CMD.EXE, only to see them finally produce a halfway decent shell—long after I’d moved on.)

(Via RedmondMag via someone I’ve forgotten (sorry).)

MacPorts tip

I started getting messages when I tried to update my MacPorts tools. I can’t say when it started, because I don’t do it very often. (Like maybe once a month. Bad me.) But it would bomb out, telling me

Error: checksum (md5/sha1/rmd160) mismatch for port.

Then it sent me down a wrong path, suggesting it was because my ISP’s DNS was serving ads or something. But it turns out the why isn’t important, because the what to do about it was right there in the FAQ:

$ sudo port selfupdate
$ sudo port clean --dist {portname}
$ sudo port install {portname}

All I had to do was clean out the bad portfile and try again.

Diff Tools

My favorite diff tool is FileMerge, one of Apple’s developer tools, which can be accessed from the command line as opendiff.

But from the command line, my (next most) favorite diff tool is colordiff. It’s called that because it color-codes the output when it’s used interactively, making it IMHO easier to see what’s changed. Actually, colordiff is just a wrapper around the real diff tool.

Another nice tool is dwdiff, which is compares two documents and highlights the different words rather than the different lines. So does wdiff.

(Back to my list of Unixy tools for the Mac.)