One liner to find processes that have been running for over 2 hours
ps -e -o pid,etimes,command | awk '{if($2>7200) print $0}'
Explanation:
ps: process snapshot command
-e: list all processes
-o: include only specified columns
pid: process id
etimes: elapsed time since the process was started, in seconds
command: command with all its arguments as a string
awk: pattern scanning and processing language
$2: second token from each line (default separator is any amount of whitespace)
7200: 7200 seconds = 2 hours
$0: the whole line in awk
Since the default action in the pattern { action } structure in awk is to print the current line, this can be shortened to:
ps -e -o pid,etimes,command | awk '$2 > 7200'
More:
man ps
man awk