Excercise: use ps to show the running time of a single Linux-process. Condition: if multiple processes occur, show the oldest. Solution: ps -C --no-header -o etime --sort=start_time | # get all processes tr -d ' ' | # eliminate spaces head -1 | # take first line (oldest) sed 's/^\([0-9][0-9]:[0-9][0-9]$\)/00:\1/' | # if process is younger than 1 hour add missing hour field (ps shortens the display to min:sec) sed 's/0\([0-9]\)/\1/g' | # eliminate leading zeros sed 's/-/ days, /' | # transform dash to days awk 'BEGIN{FS=":"} {print " " $1 " hours, " $2 " minutes, " $3 " seconds"}' | # format output sed 's/ 1 \(day\|hour\|minute\|second\)s/ 1 \1/g' # correct singular forms Open question: Is the "days-" field from ps an endless counter or do we have to expect weeks, months, years? Answer: days- does not explode to weeks or months .