65

I just received a Vagrantfile and post install bash script. The vagrantfile downloads standard Ubuntu from Ubuntu Cloud but I found something in the bash script.

Few lines of script reads as:

apt-get update -qq > /dev/null
apt-get -qq -y install apache2 > /dev/null

I tried to search around the internet what -qq in shell script stands for, didn't get any mention of it, so, am asking here if anyone knows what it stands for.

AFAIK > /dev/null means the ongoing process is not printed in the screen, for that it doesn't require the -qq flag. So, I am really curious to know.

kasperd
  • 29,894
  • 16
  • 72
  • 122

3 Answers3

88

The -qq is a flag to apt-get to make it less noisy.

-qq No output except for errors

You are correct about the >/dev/null. By redirecting all the STDOUT, the -qq becomes redundant.

Gene Gotimer
  • 2,442
  • 20
  • 16
16

The -qq makes it very quiet instead of only quiet. But from my man page, it also implies -y (--assume-yes, answers "yes" to the questions), and the man warns the use of -qq:

From the man page:

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 decided to do something you did not expect.

You could ask developer of this script to check it.

Gene Gotimer
  • 2,442
  • 20
  • 16
Zimmi
  • 1,041
  • 7
  • 11
13

In this case -qq is an option to apt-get and not bash. If you do man apt-get you will get the documentation for apt-get.

It means "really quiet"

-q, --quiet
    Quiet. Produces output suitable for logging, omitting progress indicators. More q's will produce more quiet up to a maximum of two. 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 decided to do something you did not expect.

So, to summarize a call to apt-get will be more verbose than apt-get -q which is more verbose than apt-get -qq.

Generally the first place to look for any help on a command is that command's "man" page. man is a standard Linux command that will display help for the given command. So in your case, man apt-get would give you help for the apt-get command.

shrewmouse
  • 297
  • 1
  • 7