Operating System - HP-UX
1833540 Members
2762 Online
110061 Solutions
New Discussion

how long has the process been running so far?

 
Hanry Zhou
Super Advisor

how long has the process been running so far?

by using ps -ef command, or gland, how do I find that out?
Thanks,
none
9 REPLIES 9
Jeff_Traigle
Honored Contributor

Re: how long has the process been running so far?

Assuming you mean that you want the start time of the process. Using "ps -eaf" will add the STIME to the ps display. Date only is displayed for processes started more than 24 hours ago.
--
Jeff Traigle
Steven E. Protter
Exalted Contributor

Re: how long has the process been running so far?

Shalom Hanry,

glance or ps or even top will give you the start time of the process.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
James R. Ferguson
Acclaimed Contributor

Re: how long has the process been running so far?

Hi Hanry:

Using the XPG4 (UNIX95) behavior of the 'ps' command offers the time in format [dd-]hh:mm:ss. For example:

# UNIX95= ps -e -o pid,time,etime,comm

...or for a specific pid:

# UNIX95= ps -p 5678 -o pid,time,etime,comm

Note the space (blank) after the UNIX95= . This keeps the option armed only for the commandline in question.

See the manpages for more information.

Regards!

...JRF...
Marlou Everson
Trusted Contributor

Re: how long has the process been running so far?

In Glance, the process start time is listed when you select the process (s command) but not the elapsed time.

Marlou
Senthil Prabu.S_1
Trusted Contributor

Re: how long has the process been running so far?

Hi,
Use ps command for this.

Ex:
ps -fu < user-id >

will display something like;
UID PID PPID C STIME TTY TIME CMD
rtp40 8003 7631 0 09:21 pts/0 00:00:00 su - rtp40

Here, fifth column is the process starting time, you can use awk to manipulate the time, how long the process is running.


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Senthil Prabu.S_1
Trusted Contributor

Re: how long has the process been running so far?

Hi,

You can use ps command as;

#ps -e -o etime

This will list out the elapsed time of all process.


HTH,
Prabu.S
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Muthukumar_5
Honored Contributor

Re: how long has the process been running so far?

Using ps commands etime will give the established time.

UNIX95= ps -ef -o pid,comm,etime,time

--
Muthu
Easy to suggest when don't know about the problem!
Sivakumar TS
Honored Contributor

Re: how long has the process been running so far?


Hi Hanry,

#ps -ef o stime

will display the start time of the process

#ps -ef o etime

will display the elapsed time of the prosess

you can use grep along with this to get the requied process stats.

Regards,

Siva.
Nothing is Impossible !
Sivakumar TS
Honored Contributor

Re: how long has the process been running so far?


Hi Hanry,

#ps -e o stime

will display the start time of the process

#ps -e o etime

will display the elapsed time of the prosess

you can use grep along with this to get the requied process stats.

Regards,

Siva.
Nothing is Impossible !