1

Get pid of last started instance of a certain process

view story
linux-howto

http://stackoverflow.com – I have several instances of a certain process running and I want to determine the process id of the one that has been started last. So far I came to this code: ps -aef | grep myProcess | grep -v grep | awk -F" " '{print $2}' | while read line; do echo $line done This gets me all process ids of myProcess. Somehow I need to compare now the running times of this pids and find out the one with the smallest running time. But I don't know how to do that... (HowTos)