I don't why I can't run the command now ,maybe my shell changed...It doesn't matter..
So the command is not very good . we use a script.
First we find out the pid of process that has running in the system for more than 3 days.
find /proc -maxdepth 1 -mindepth 1 -type d -mtime +1 2>/dev/null| egrep -v /proc/[a-Z] | awk -F"/" '{print $3}' | tee /tmp/a
Second we can find which process with pid.
while read pid
do
ps -p $pid -o stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm # you can modify it to get what you want...
done < /tmp/a
FYI:
[root@unix proc]# ps -p 4062 -o stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
STAT EUID RUID TT TPGID SESS PGRP PPID PID %CPU COMMAND
Ss+ 0 0 tty2 4062 4062 4062 1 4062 0.0 mingetty
---------- Post updated at 09:11 AM ---------- Previous update was at 09:07 AM ----------
Oh no, so we can't use /proc ...
---------- Post updated at 09:28 AM ---------- Previous update was at 09:11 AM ----------
so can we use this option of ps below ?
bsdstart START time the command started. If the process was started less
than 24 hours ago, the output format is " HH:MM", else it
is "mmm dd" (where mmm is the three letters of the month).
[root@unix proc]# ps -ea -o bsdstart,comm,pid | head
START COMMAND PID
18:41 init 1
18:41 migration/0 2
18:41 ksoftirqd/0 3
18:41 watchdog/0 4
18:41 events/0 5
18:41 khelper 6
18:41 kthread 7
18:41 kblockd/0 10
18:41 kacpid 11
So we need to determine the start-time;
HH -gt 70 ?
Then we can say the process is three days old.