Hacker News new | ask | show | jobs
by FfejL 2206 days ago
I've been using Unix in one form or another since 1986, and I was today years old when I learned about 'grep -c'. I've probably done some form of 'grep foo | wc -l' once or twice a month every month over those 34 years.

While I'm sure that says something about me, it also says something about the depth and complexity of Unix/Linux. There is a LOT there, so it's not surprising that people find less-than-optimal ways to solve their problems.

2 comments

This is a classic example of blaming users for not being able to understand/remember/intuit a mess of wretchedly hostile design with no consistent logic or standardisation.

Vintage operating systems like TOPS-20 and VMS (up to a point) would go out of their way to be friendly and helpful. Conscious effort was put into this.

Unix shell commands seem to be the opposite - random feature accretion with deliberately obscure magic-spell UX.

What percentage of the population can define what "catenate" means without looking it up - never mind work out what "cat" abbreviates without being told?

How about left/right precedence and data flow? Why do some commands/operators have left precedence while others have right precedence? How about switch standardisation? Are the switches '--' or just '-' or maybe just a letter? Can you pipe subcommands to variables or not? [1]

And so on. Of course users don't immediately produce minimal solutions. Most users won't, most of the time.

[1] It depends on the shell. Mostly not reliably, because you often get different behaviour inside a terminal command and a shell script.

That particular example actually says nothing against you, and certainly doesn't mean the Unix tools are hostile, as the neighbor comment says. The ‘grep|wc’ flow is natural in the Unix paradigm, because each command does its own thing there—it's exactly like functional programming. The ‘grep -c’ thing is a shortcut that may be an optimization but doesn't conform to the ideals.

I don't know if it's easier for humans to remember one command with flags or two commands, but it's certainly best to recognize the principles and learn to use them, which is what the ‘grep|wc’ case demonstrates.