Time

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Time

ubuntu-users mailing list
Hi All

While re-viewing the difference(s) between full-upgrade, dist-upgrade and
upgrade

I came across (on Ask Ubuntu)

sudo apt update && time sudo apt upgrade

So it may be a stupid question but what does "time" do in the middle there?

I know that if update is not run often and is on a slow connection, sudo can
time out before before that second sudo command (so need password again) is
this a work-around? or a check to insure the password is required

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Time

Volker Wysk
Am Dienstag, den 05.11.2019, 18:15 +0000 schrieb Grizzly via ubuntu-
users:

> Hi All
>
> While re-viewing the difference(s) between full-upgrade, dist-upgrade
> and
> upgrade
>
> I came across (on Ask Ubuntu)
>
> sudo apt update && time sudo apt upgrade
>
> So it may be a stupid question but what does "time" do in the middle
> there?
>
> I know that if update is not run often and is on a slow connection,
> sudo can
> time out before before that second sudo command (so need password
> again) is
> this a work-around? or a check to insure the password is required

"time" measures the time used by the specified program. The program
("apt upgrade" in your case) is executed and time statistics are
printed afterwards. It's not a workaround.

See time(1).

Volker


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Time

Paul Smith-2
In reply to this post by ubuntu-users mailing list
On Tue, 2019-11-05 at 18:15 +0000, Grizzly via ubuntu-users wrote:
> sudo apt update && time sudo apt upgrade
>
> So it may be a stupid question but what does "time" do in the middle
> there?

It prints out how long the command took to run.  That's all.

> I know that if update is not run often and is on a slow connection,
> sudo can time out before before that second sudo command (so need
> password again) is this a work-around? or a check to insure the
> password is required

Nope, nothing like that.  The time command will run the command given
as arguments and, when it's done, print how long it took to run.

  $ time sleep 5

  real    0m5.001s
  user    0m0.001s
  sys     0m0.000s



--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Time

Paul Smith-2
On Tue, 2019-11-05 at 13:43 -0500, Paul Smith wrote:
> On Tue, 2019-11-05 at 18:15 +0000, Grizzly via ubuntu-users wrote:
> > sudo apt update && time sudo apt upgrade
> >
> > So it may be a stupid question but what does "time" do in the
> > middle there?
>
> It prints out how long the command took to run.  That's all.

I should have also mentioned, when you don't know what something does
on the command line, you can use the "man" program to see the manual
page about it.  Most command-line tools have such documentation:

  $ man time
  TIME(1)                     General Commands Manual                    TIME(1)

  NAME
         time - run programs and summarize system resource usage

  SYNOPSIS
      ...lots of info...

Cheers!


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Time

ubuntu-users mailing list
In reply to this post by Volker Wysk
05 November 2019  at 19:37, Volker Wysk wrote:
Re: Time (at least in part)

Thanks

>Am Dienstag, den 05.11.2019, 18:15 +0000 schrieb Grizzly via ubuntu-
>users:
>> Hi All
>>
>> While re-viewing the difference(s) between full-upgrade, dist-upgrade
>> and
>> upgrade
>>
>> I came across (on Ask Ubuntu)
>>
>> sudo apt update && time sudo apt upgrade
>>
>> So it may be a stupid question but what does "time" do in the middle
>> there?
>>
>> I know that if update is not run often and is on a slow connection,
>> sudo can
>> time out before before that second sudo command (so need password
>> again) is
>> this a work-around? or a check to insure the password is required

>"time" measures the time used by the specified program. The program
>("apt upgrade" in your case) is executed and time statistics are
>printed afterwards. It's not a workaround.

So at the boundry between needing and not needing the password again it "could"
make a small difference, but normally it will not have that effect

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Time

Oliver Grawert
hi,
Am Dienstag, den 05.11.2019, 18:48 +0000 schrieb Grizzly via ubuntu-
users:

> So at the boundry between needing and not needing the password again
> it "could" 
> make a small difference, but normally it will not have that effect
>

it has no effect at all, it will only print statistical info about how
long the command took to execute, it does not influence the behaviour
in any way.

ciao
        oli
--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Time

Ken D'Ambrosio
In reply to this post by ubuntu-users mailing list
On 2019-11-05 13:48, Grizzly via ubuntu-users wrote:
> 05 November 2019  at 19:37, Volker Wysk wrote:

> > I came across (on Ask Ubuntu)
> >
> > sudo apt update && time sudo apt upgrade

> So at the boundry between needing and not needing the password again it
> "could"
> make a small difference, but normally it will not have that effect

I'd have to say "No."

kdambrosio@methuselah ~ $ time time

real 0m0.000s
user 0m0.000s
sys 0m0.000s


Nutshell: time, itself, uses essentially no time -- given the speed of
computers these days, likely in the microseconds, whereas doing things
like authentication checks and stuff (needed by sudo) can take into the
milliseconds.  Personally, I have no idea why it was in that command in
the first place.  It would have no real affect on functionality.  
Perhaps something was taking longer to run that expected, and they were
doing a crude attempt at diagnosing things?  If so, strace, while vastly
more complex, is also vastly better-suited for profiling.

$.02,

-Ken

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|

Re: Time

Paul Smith-2
On Tue, 2019-11-05 at 14:00 -0500, Ken D'Ambrosio wrote:
> Personally, I have no idea why it was in that command in the first
> place.

I'm sure it was there just for informational purposes, to have some
idea how long the upgrade took (if someone went out for a sandwich
while it was running).

It makes absolutely no difference whatsoever to the actual operation
performed or how it works.


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users