I plan to use the ‘time’ command to measure the execution time of a program with the Debian distribution on my BB Black.
I wish to have the output in a specific format, which can be achieved using the ‘–format’ parameter and I have used this previously on some Ubuntu projects.
However, for this I need to access the ‘time’ command using the full path where it is installed from, which is typically /usr/bin.
I am not able to find where ‘time’ is installed on my BB Black. As such, even a basic command like ‘time --help’ throws error. Though invoking ‘time’ followed by any executable does give me the real/system/user execution times, but that’s not the format I am interested in.
Any clues as to where is the ‘time’ executable located on this Debian distribution?
@Robert
I get no response when I use the ‘which’ command. I think this is kind of expected because I couldn’t ‘find’ the ‘time’ executable anywhere in the root directories.
@William
I think it is installed because it does measure the execution times, however I am not able to find the path of it’s installed executable.
Actually I misread my own test of that. As has been pointed out the bottom line is install the time package. time is not a shell builtin, it’s a shell (bash) keyword. Using type -a will show you this. Using which will not show builtins or keywords. You mentioned having to use the full path to use the time command. That comes down to order of execution by the shell. Unless disabled, by default keywords and builtins will execute first, then the search path. A quick hack around using the full path is simply using a \ first i.e. \time -f blah blah mike@tightrope:~$ type -a time time is a shell keyword time is /usr/bin/time time is /usr/bin/X11/time mike@tightrope:~$ time --version bash: --version: command not found real 0m0.002s user 0m0.000s sys 0m0.000s mike@tightrope:~$ \time --version GNU time 1.7 mike@tightrope:~$ Mike
william@arm:~$ which time /usr/bin/time
william@arm:~$ sudo apt-get remove --purge time
[sudo] password for william:
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following packages will be REMOVED:
time*
0 upgraded, 0 newly installed, 1 to remove and 7 not upgraded.
After this operation, 124 kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database … 13376 files and directories currently installed.)
Removing time …
william@arm:~$ which time
william@arm:~$ time --help -sh: time: command not found
william@arm:~$ sudo apt-get install time
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
time
0 upgraded, 1 newly installed, 0 to remove and 7 not upgraded.
Need to get 0 B/33.9 kB of archives.
After this operation, 124 kB of additional disk space will be used.
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76, <> line 1.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can’t locate Term/ReadLine.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.14 /usr/share/perl/5.14 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7, <> line 1.)
debconf: falling back to frontend: Teletype
Selecting previously unselected package time.
(Reading database … 13364 files and directories currently installed.)
Unpacking time (from …/archives/time_1.7-24_armhf.deb) …
Setting up time (1.7-24) …
william@arm:~$ which time /usr/bin/time
william@arm:~$ time --help Usage: time [-apvV] [-f format] [-o file] [–append] [–verbose] [–portability] [–format=format] [–output=file] [–version] [–quiet] [–help] command [arg…]
william@arm:~$