Okay so I don’t really understand how the
time command appears to be both installed and not installed at the same time but I thought I’d post it here in case it save someone some time.
So it appears to be working in so far as you can time how long a command takes to execute. Below I use it to see the
ls execution time:
[email protected]:~$ time ls real 0m0.001s user 0m0.000s sys 0m0.000s
I only noticed there was an issue because I wanted to see more detailed information, like the
Page size but could see that it wasn’t recognising the
[email protected]:~$ time -v ls -bash: -v: command not found real 0m0.001s user 0m0.000s sys 0m0.000s
I checked the
man page and sure enough – no
-v. Weird! So then I thought I’d run the command using the full path just in case. To check where it was located a used
[home-pc ~]# which time which: no time in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl)
Hummm, so I looked for the file using the
find command and the below is all I found.
[home-pc ~]# find / -name time -type f /sys/devices/pnp0/00:01/rtc/rtc0/time /sys/module/printk/parameters/time find: ‘/run/user/1000/gvfs’: Permission denied [home-pc ~]#
So I then decided to try “reinstalling” it only to then find it wasn’t installed at all!
[home-pc ~]# pacman -Sy time
And now everything works as expected!
[home-pc ~]# which time /usr/bin/time
And now at last I can see the
[homepc ~]# /usr/bin/time -v ls vms Command being timed: "ls" User time (seconds): 0.00 System time (seconds): 0.00 Percent of CPU this job got: 100% Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00 Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 1920 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 86 Voluntary context switches: 1 Involuntary context switches: 0 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096
Weird……..and kind of annoying to be honest!
I think the original
time command must be a striped-down version included in the kernel. After a bit of researching, seems its a built-in (shell) command of the GNU/Linux Core Utilities.
Be the first to comment