Orphaned processes

From my understanding orphaned processes imply the processes which are not actually running really.it might have already finished buy still showing the process Id

Is there any command to filter out those orphaned processes alone?

If a process has finished but is still hanging around in the process list, it's not an orphan. What you're describing is a zombie. The process is dead but it's still in the process list in case its parent tries to check its exit status.

If the parent exits without ever checking the zombie child's exit status, the zombie child at that point becomes an orphan. However, the orphaned zombie exists only very briefly in this state; the init process adopts it and the zombie disappears.

If instead the child process was still active when the parent exits, it becomes an orphan without ever being a zombie. It is adopted by init and it continues running as if nothing had happened.

So, what are you trying to filter? Zombies or orphans? Also, you should state what operating system you're using, since process list tools tend to be highly unportable.

Regards,
Alister

Both zombies and orphaned processes I need to check.
My operating system is sun OS4.

Thanks