Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Agree 100%. There isn't some magic potion that makes commands compose simply and efficiently.


There is, but it involves using a standardized structured data exchange format instead of formatted text.

powershell solves this by using structured data everywhere at the expensive of not working that well with plain text.

You should be able to run something like

  ls -l | sort +date,-size
but you can't :-)


Right, but the same people who keep advocating "do one thing and do it well" also keep advocating "Write programs to handle text streams, because that is a universal interface," and there's no way to handle that sort of things with text streams. A "universal interface," whatever that means, cannot carry that metadata.


I know.. It's almost like the people who came up with these ideas 40 years ago didn't think of everything.

There are plenty of ways to do things better with basic text interfaces - a more standardized header format for example.

If most tools just output tabbed separated values with a header, or the same thing vertically.. ie..

    foo bar baz
    1   2   3
    4   5   6
or

    foo 1   4
    bar 2   5
    baz 3   6
It would have been a lot easier to write more "universal" tools that worked with this data.

Or at least more tools like 'ifdata' that is part of moreutils.

  $  ifdata -pa wlan0
  192.168.1.2
Instead of the mess people come up with to parse ifconfig output.

Bryan Cantrill even said in a presentation something like that it should be "Write programs to handle json text streams, because that is a universal interface" these days.


Sure you can. 5th column of `ls -l` is size; sort can do numerical values

> ls -tl | sort -k 5 -n


Not the same thing,

  ls -l | sort +date,-size
was to show how sorting by date ascending and size descending could work. 'sort' can sort by different fields in different orders, but to sort times properly you'd need to use ls with `--full-time` or --time-style=long-iso` which is in GNU ls but not the BSD ls on OS X.

You'd end up with something like

  ls -l --full-time |sort -k 6,5rn
But that doesn't quite work. Besides, the 'sort -k 6,5rn' instead of 'sort +date,-size' is exactly the kind of thing I was trying to show.

We could have had a sort that let you do '+date,-size', instead we have a 'universal interface'.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: