Tag Info

New answers tagged

1

If you like to time commands for performance reasons, I recommend not to use /usr/bin/time but either ptime(1) if this available on your platform - ptime gives a nanosecond resolution - or to use a recent Bourne Shell, as the Bourne Shell allows to automatically time all foreground commands (including shell builtins) with a microsecond resolution on all ...


5

The structure of a pipeline doesn't allow time in the middle, only at the start of the pipeline. Also, time is a "shell keyword", as shown by type time. But nothing forbids the use of compound commands (and time each): time comm1 | ( time comm2 ) So, you could workaround using a sub-shell, like this: echo "12" | ( time python3 -c "a=input("");print(a)" ...


3

Using last you can find this information. The following may be useful: last <username> | less It will return something like this: benlavery@Talantinc:bin $>last benlavery | less benlavery ttys005 Mon Aug 31 09:58 still logged in benlavery ttys005 fe80::105e:6b27:29ff:d967%en0 Mon Aug 31 09:14 - 09:36 (00:22) benlavery ...


3

There is two types of time commands. One is shell built-in, belongs to bash. That's the one you see in your first example. Second one , is /usr/bin/time, that's the second one you saw. As for why it's different output, it's because you cannot pipe output to shell builtins. More on that here


2

When you invoke a command without specifying path to it, others shell alias, function, builtin with the same name will be invoked, instead of command. This behavior was defined by POSIX. In order to call external time command, you can use command: command time --verbose cmd


2

Because /usr/bin/time and the time build into your shell are completely different implementations. Run help time to get the usage of the one built into your shell, and obviously man time for the one in /usr/bin/time.


1

I guess that your OS is some flavor of Linux. Be sure that your $DD/batchfile.batch file exists and is readable & executable. I believe that your batch(1) job is started. Perhaps it is exited quickly (e.g. because the PATH for batch jobs is perhaps not your interactive PATH, or because your environment is not the same as in interactive shells - see ...


7

By default, watch runs your command with /bin/sh -c '...' so the output you see is how /bin/sh interprets the time command. Your /bin/sh apparently doesn't have a builtin time. To run the command with a different shell, use the -x option to get rid of the default, then add your own explicit invocation of the shell whose builtin you want. watch -x bash -c ...


2

Mac OS X doesn't ship with the GNU stack. You have "BSD Time" time.c,v 1.9. You can verify this by typing: strings /usr/bin/time | grep c,v BSD time doesn't support --verbose, but it does support /usr/bin/time -lp: $ /usr/bin/time -lp echo hi hi real 0.02 user 0.00 sys 0.00 700416 maximum resident set size 0 ...


0

hwclock(8) appears to read the hypervisor's clock # hwclock --show --debug hwclock from util-linux 2.20.1 Using /dev interface to clock. Last drift adjustment done at 0 seconds after 1969 Last calibration done at 0 seconds after 1969 Hardware clock is on unknown time Assuming hardware clock is kept in UTC time. Waiting for clock tick... ...got clock tick ...


0

I used this code and was able to solve my problem: inode=$(find /path/ -maxdepth 1 -type f -iname '*error*.log' -printf '%T@ %i\n' | sort -rn | awk '{print $2;exit;}') newest=$(find /path/ -maxdepth 1 -inum "$inode")



Top 50 recent answers are included