There are a couple of things getting confused in this thread.
Bash has a built-in time
command which supports a TIMEFORMAT
environment variable that will let you format the output. For details on this run man bash
and search for TIMEFORMAT
.
There is also a standard /usr/bin/time
command-line utility which supports a TIME
environment variable that will let you format the output (or you can use -f
or --format
on the command line). For details on this run man time
and search for TIME
.
If you want the number of seconds the command took to run you can either use the built-in bash command (which supports a maximum precision of three decimal places):
bash# export TIMEFORMAT="%3lR"
bash# time find /etc > /dev/null
0m0.015s
Or you can use the command-line utility (which supports a maximum precision of two decimal places):
shell# export TIME="%E"
shell# /usr/bin/time find /opt/ > /dev/null
0:00.72
As mentioned above neither of these variables are used by anything else and are safe to change.