Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know the time command allows you to time the execution of a given command. But is it possible to get the execution time of the previous command without re-executing that previous command?

share|improve this question
2  
Only if it happened to log something somewhere at the beginning and end of its run, and both entries included a timestamp. –  Sammitch Feb 20 '13 at 21:38

1 Answer 1

up vote 11 down vote accepted

If you run around the block and don't measure the amount of time it took, didn't watch any clocks before, during or after and no people saw you do it, you also don't know how long it takes on average; would you be able to tell how long it took you to run around the block?

No.


At best, you can know when you launched a certain application.

HISTTIMEFORMAT="%F %T " history

But that doesn't tell you when it has ended, which you will need to deduce, if at all possible.

share|improve this answer
3  
It could have been possible that the duration of every command was stored temporarily somewhere. I would have found it surprising if it was like that but it's not like I haven't been surprised before, no need to be patronizing. That command to know when a command was launched is good to know however, thanks. –  Bentley4 Feb 20 '13 at 22:01
2  
@Bentley4: If there were such thing, there would have been an option for that in the kernel; there are options for that, but these options are tracing tools that aren't enabled by default which brings it down to needing to turn on the tracing in advance. The only remaining thing I can think off is an ability to know when you gained back your input (so you can do $input_time - $last_history_touch), but I don't know if that is kept track of anywhere. Maybe you can set up something preventive that allows you to determine the run time of any prior process at any point in time... –  Tom Wijsman Feb 20 '13 at 22:07
    
Good advice, thanks. –  Bentley4 Feb 20 '13 at 22:20

Your Answer

 
discard

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.