APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

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.

Got something to add? Send me email.

Increase ad revenue 50-250% with Ezoic

More Articles by

Find me on Google+

© Tony Lawrence

Kerio Samepage

Have you tried Searching this site?

Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more.

Contact us