when timing a command execution time with sudo, `time` should be before `sudo` or after `sudo`?
time sudo command
executes your shell's time
builtin if it has one, whereas sudo time command
always executes the time
executable in the program search path ($PATH
).
time sudo command
includes the time taken by the sudo
command, whereas sudo time command
doesn't.
You should use sudo time command
, because sudo
's processing time is small but not always negligible, and its wall clock time may be a lot larger if the user needs to enter a password.