Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a view to log and list down the processes executed in last 10 seconds ?

I especially want to trace the command line.

share|improve this question
I don't know about timing, I don't think it is logged. But, this answer may help you to achieve what you want unix.stackexchange.com/a/67/14084 – Bernhard Jan 16 '13 at 7:39
Try ps kstart_time -ef. I think it'll help you to understand how to get what you want. – Eddy_Em Jan 16 '13 at 7:46
Note that you spawn/fork a process and you execute a command. A command may spawn several processes, some of which may execute another command, some of which would not. – Stéphane Chazelas Jan 16 '13 at 11:06
up vote 1 down vote accepted

If process is not finished, you could find them by:

ps axho etime,cmd| sed ':a;s/^\(0*\) /\10/g;ta' | sort | less

But if process is already finished, it's less sure:

You have to know where to search...

Warning! following work only if the binary is not in cache memory: if they was not accessed from a while.

Maybe a simple ls -ltru could be enough:

/bin/ls -ltru /etc/init.d | tail

If else, more sophisticated command could be:

find /usr/bin -type f -amin -1

find ${PATH//:/ } -type f -amin -1

find ${PATH//:/ } /home/*/bin -type f -amin -1

will show up all files accessed from less than one minute.

For 10 secs, it's more difficult:

while read time;do
    read name
    [ $time -lt 10 ] && echo $name
  done < <(find ${PATH//:/ } /home/*/bin -type f -amin -1 -print0 |
    xargs -0 --no-run-if-empty stat -c $(date +%s)$'-%X ;"%n\n"' |
share|improve this answer

Try this:

ps k-etime h -eo etimes,command | while read etime comm; do [ $etime -lt 10 ] && echo -e "$etime\t$comm"; done

This will show all processes that was started in last 10 seconds and are still running.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.