Google Certified Associate Cloud Engineer 2020

Sign Up Free or Log In to participate!

In start-up script, what does “-yq” do in “apt-get -yq update”?

Does it mean default answer as yes reg any questions that may pop up? If so, why not use "-y"?

Yansheng Zhang

Does adding q an intermediate strategy between "-y" and "q", that automates yes for all prompts but also provide suitable output for logging, omitting progressive indicators?

Aamir Pinger

-y will not ask for any permission and take it as explicit YES and -q is refer to quiet mode and will not generate logs that we usually see while apt-get command is in execution

1 Answers

The -yq, surpress output normally spit out by the command and the -y forces a yes answer to all the questions that the package manager would ask, like "Should the package xxx be installed (Y/n)? ".

https://manpages.ubuntu.com/manpages/trusty/man8/apt-get.8.html

-q, –quiet

Quiet; produces output suitable for logging, omitting progress indicators. More q’s

will produce more quiet up to a maximum of 2. You can also use -q=# to set the quiet

level, overriding the configuration file. Note that quiet level 2 implies -y; you

should never use -qq without a no-action modifier such as -d, –print-uris or -s as

APT may decide to do something you did not expect. Configuration Item: quiet.

-y, –yes, –assume-yes

Automatic yes to prompts; assume "yes" as answer to all prompts and run

non-interactively. If an undesirable situation, such as changing a held package,

trying to install a unauthenticated package or removing an essential package occurs

then apt-get will abort. Configuration Item: APT::Get::Assume-Yes.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?