Consider this shell redirect:
telnet towel.blinkenlights.nl >> starWarz
when it ends, the session will break, detach from host or something like that. I want to know how long the connection lasts. How might I determine this?
Asked
Active
Viewed 5,143 times
2
-
18m48s if anyone is interested. It conists of 3413 frames, and the fps is around 3. (dang, that was my first guess for fps) – j0h Apr 05 '16 at 15:24
2 Answers
3
Sounds like you're looking for the time
builtin:
$ help time
time: time [-p] pipeline
Report time consumed by pipeline's execution.
Execute PIPELINE and print a summary of the real time, user CPU time,
and system CPU time spent executing PIPELINE when it terminates.
Options:
-p print the timing summary in the portable Posix format
The value of the TIMEFORMAT variable is used as the output format.
Exit Status:
The return status is the return status of PIPELINE.
It will print a report of the time taken by a command. For example:
$ time sleep 3
real 0m3.027s
user 0m0.000s
sys 0m0.000s
The "real" field is the actual time that passes, the same value you would have measured with a watch. So, you can simply do:
time telnet towel.blinkenlights.nl >> starWarz

terdon
- 100,812
2
Most of the shells has a builtin named time
, bash
has it too. It will show you the actual human time (real
) a process takes with the CPU time the process spends on user space (user
) and kernel space (sys
).
So run the command perpending time
:
time telnet towel.blinkenlights.nl >> starWar
At the end bash
will show the time on STDERR like:
real XmX.XXXs
user YmY.YYYs
sys ZmZ.ZZZs
Even if you are on a shell that does not have the time
builtin you have the external time
command /usr/bin/time
from the time
package. The usage is same.

heemayl
- 91,753