I am not really wanting to replace ps but I am hoping that someone has written a ps wrapper of some sort that can give it some functionalities. I am looking for one that can maybe do the following:
sort the process from oldest/newest running process
list process that has been started x-time ago, i.e. x-hours/minutes ago. Most especially need this one
All this is relatively easy: ps has a lot of fields you can selectively display in the output. For instance:
"list process 'complete' arguments"
Start with ps -Ao . The -o takes a list of parameters, separated by comma, which are listed in the manpage. What you want here is (quotes from the Linux man page):
-o format
User-defined format. format is a single argument in the form of
a blank-separated or comma-separated list,
[...]
args COMMAND command with all its arguments as a string.
Modifications to the arguments may be shown. The
output in this column may contain spaces.[...]
So your command would be ps -Ao args to display the complete comands with arguments or maybe ps -Ao pid,ppid,args to display 3 columns with the process' ID, the parent PID and the complete command with arguments for each process, etc.. Analogous for your other requirements. Simply consult the man page and look up the "standard format specifiers" and which information they display.
You tailor the output using this the way you need it for your purposes. Then you do the sorting either by using the --sort parameter (again, see the man page for details) if you have the GNU-ps (which is not portable, so be warned) or just use the standard sort utility to sort ps 's output.
Normally, when I need to pull "ps-like information" I always pull directly from the Linux proc filesystem. That is one of the main advantages of the Linux proc filesystem, in my view, as least from the sys admin perspective.
In the poster's original message, and indeed in the entire thread, I did not find any mention of the system (unless I missed it somehow!) ; and as we all know, all these Linux and UNIX commands work differently based on the OS.
So, please provide the OS system details when posting these kinds of questions.