The ps command with the -o etime or etimes option can be used to display how long a process has been running for (elapsed time).
In this example, the process associated with process ID number (PID) 12345 has been running for 20 seconds.
~]$ ps -p 12345 -o etime ELAPSED 00:20
Often, you will want to know more about the process. The command option can be included to get an idea of what command the process is associated with.
~]$ ps -p 12345 -o etime,command ELAPSED COMMAND 00:20 /usr/bin/foo