///ps sorting

ps sorting

ps sorting

In the beginning, when large creatures lumbered through damp tropical forests and furry mammals hid quivering in their burrows, "ps" had no built in abilty to change its sort order. You got what it gave, and if you wanted it otherwise, you ran it through "sort" yourself. That is the Unix Way: small tools, working together with pipelines.

BSD mucked with that a bit, adding a "-m" option that sorted by memory usage, instead of by process ID. As that’s a pretty common desire, I doubt anyone saw that as an offense to the Unix gods, though really it was. But it was convenient, wasn’t it?

But now Linux ps adds something much more nasty. Not only does Linux ps have a built-in "–sort" option (added by Charles Blake, so says the man page), it also overloads "-O" which originally was used for user defined formats (specifying the fields you want to see) to do the same thing. Sacrilege! The sanctity of the Unix Way is violated by this insertion. Do you see what happens when you let the camel poke his nose in the tent? That little "-m" was so convenient, and now look at this mess! Pretty soon ps will be drawing graphs and outputting html!

I’m only half kidding. Linux ps with –sort can be convenient, but it is also feature bloat and I’m not entirely happy to see that. Too much camel in the tent, I think.

2010-05-25T23:08:42+00:00 September 2nd, 2005|Linux|0 Comments

About the Author:

Leave A Comment