Operating System - HP-UX
1837893 Members
3546 Online
110122 Solutions
New Discussion

Re: how to check process by age..

 
SOLVED
Go to solution
Yashodhan Deo
Occasional Advisor

how to check process by age..

Hi can u tell me how can one check the processes by their age. I mean I want the new process on the top of the list. Also can we automatically divert the output to a file for further reference
3 REPLIES 3
Steve Steel
Honored Contributor
Solution

Re: how to check process by age..

Hi


With unix95


1 echo memory usage per process
2 echo "----------------------------------------------"
3 UNIX95= ps -e -o stime,ruser,vsz,sz,pid,ppid,tty,args > /tmp/$PPID
4 head -n 1 /tmp/$PPID
5 tail -n +2 /tmp/$PPID|
6 sort -rn
7 /bin/rm /tmp/$PPID 2>/dev/null


Will do it


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
Sanjay Kumar Suri
Honored Contributor

Re: how to check process by age..

Check the following:

ps -eaf|sort -r -k 2,2

Redirect the output with > symbol such as

ps -eaf|sort -r -k 2,2 > filenm

sks
A rigid mind is very sure, but often wrong. A flexible mind is generally unsure, but often right.
Muthukumar_5
Honored Contributor

Re: how to check process by age..

You can use top command to view all the process status with execution time.

If you want to redirect then ps is very good to keep track.

stime - gives the starting time of process
time - will give amount of time running

ps -ef | grep -v "STIME" | sort -r -k 7,7

It will give the details / redirect to any other file
Easy to suggest when don't know about the problem!