Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

If I use apt-get install -qq mono-devel, I expect it to be quiet except for errors, according to the help:

-qq No output except for errors

Instead I get:

Extracting templates from packages: 100%
Selecting previously unselected package binfmt-support.
(Reading database ... 84711 files and directories currently installed.)
Unpacking binfmt-support (from .../binfmt-support_2.0.8_i386.deb) ...
Selecting previously unselected package cli-common.
Unpacking cli-common (from .../cli-common_0.8.2_all.deb) ...
Selecting previously unselected package libgdiplus.
Unpacking libgdiplus (from .../libgdiplus_2.10-3_i386.deb) ...
Selecting previously unselected package libmono-2.0-1.
Unpacking libmono-2.0-1 (from .../libmono-2.0-1_2.10.8.1-1ubuntu2.2_i386.deb) ...
Selecting previously unselected package libmono-2.0-dev.
Unpacking libmono-2.0-dev (from .../libmono-2.0-dev_2.10.8.1-1ubuntu2.2_i386.deb) ...
Selecting previously unselected package libmono-corlib4.0-cil.
Unpacking libmono-corlib4.0-cil (from .../libmono-corlib4.0-cil_2.10.8.1-1ubuntu2.2_all.deb) ...
Selecting previously unselected package libmono-system-xml4.0-cil.
Unpacking libmono-system-xml4.0-cil (from .../libmono-system-xml4.

and more...

In fact, a couple hundred lines worth of output. This does not appear to match up with no output except for errors.

How do I actually get apt-get install to print out only when there are errors keeping it from installing?

share|improve this question
+1 for reading the help file – don.joey Feb 19 '13 at 13:51
Have you tried using -q=# where # is a quiet level? (It's in the manual.) You may want to raise a bug report against this. – Paddy Landau Feb 26 '13 at 9:26
@PaddyLandau I did indeed. I don't know why it's talking about selecting previously unselected package either or why that would be important, and I'm not sure if it's related to the state of the vms I'm running this on these on either, travis-ci. But the answer worked well. – jbtule Feb 26 '13 at 13:38
"Selecting previously unselected package" simply means that the package manager is including a package required to satisfy dependencies. As I previously wrote, you may want to raise a bug report about the --quiet option appearing not to be working correctly. – Paddy Landau Feb 26 '13 at 17:35
I'm unhappy to report that same symptom in Ubuntu 15.04 20150709. – Lloyd Dewolf Aug 7 '15 at 21:02
up vote 22 down vote accepted

The man page for apt-get is as follows:

       apt-get - APT package handling utility -- command-line interface

       apt-get [-asqdyfmubV] [-o=config_string] [-c=config_file] [-t=target_release]
               [-a=architecture] {update | upgrade | dselect-upgrade | dist-upgrade |
               install pkg [{=pkg_version_number | /target_release}]...  | remove pkg...  |
               purge pkg...  | source pkg [{=pkg_version_number | /target_release}]...  |
               build-dep pkg [{=pkg_version_number | /target_release}]...  |
               download pkg [{=pkg_version_number | /target_release}]...  | check | clean |
               autoclean | autoremove | {-v | --version} | {-h | --help}}

The -q or -qq flag should go before the command, like so:

apt-get -qq upgrade

share|improve this answer
This is the correct answer! Any practical implementation needs to preserve prompts. Used correctly, -q absolutely works (no "animated" output) as well as -qq (no output except errors). Please upvote! – charneykaye Aug 19 '15 at 19:18
No, it doesn't work. Even with -qq before the install command I still get tons of junk everything from reading database to unpacking and setting up messages. – CrazyCasta Jun 20 at 23:55
@CrazyCasta what command are you using? – Mike Jun 21 at 7:34
Well, I've tried sudo apt-get -qq -y install mercurial, sudo apt-get install -qq -y mercurial, sudo apt-get -qq install -qq -y mercurial and other variations involving even more q's (though I don't see any documentation that suggests this would work. I'm running Debian Jessie on google cloud btw (8). I've also tried Goetz's answer and it doesn't seem to work either. By doesn't seem to work I mean I don't notice a difference. – CrazyCasta Jun 22 at 15:49
This works for me on Ubuntu 14.04 - are you sure that there hasn't been a change in behaviour for Debian Jessie? Does the apt-get manpage look like the above? – Mike Jun 24 at 22:51

A simple redirection could do this. It's not exactly what you had in mind, I'm sure, but it sure as hell works :)

In short, just whack > /dev/null on the end of any command where you want to redirect all the stdout into nothingness. Things outputted on stderr will still show in the console.

$ sudo apt-get update > /dev/null
[sudo] password for oli: 

No junk! And here's what happens if we're silly and break something:

$ apt-get cheese > /dev/null
E: Invalid operation cheese
share|improve this answer
That's a bit of a problem if you get a prompt... – l0b0 Feb 19 '13 at 16:44
@l0b0 Hmm, yeah it is. Don't really know how to suggest splitting out prompts other than knowing when to expect them (removals and unverified packages are the only ones in there IIRC). Or, add -y into the mix (with caution!) – Oli Feb 19 '13 at 16:53
The OP was fine with using -qq which implies -y. So adding a -y or just running his original apt-get upgrade -qq > /dev/null give the same result – Wulfhart Feb 19 '13 at 19:59
@Oli If you're absolutely sure you're not going to make your system catch on fire, you could always sudo apt-get upgrade -qq --force-yes > /dev/null. -qq implies -y, as WulfHart said, and --force-yes makes it plow through just about anything. – JamesTheAwesomeDude Feb 26 '13 at 13:46
@Vorac No it's just redirecting stdout (seeing the errors is a desirable thing IMO). – Oli Mar 27 '13 at 13:34

We faced the same problem. apt-get install -qq removes most of the outputs but annoying "(Reading database ..." still persist.

We took a look in the source of apt and discover that the output is produced by dpkg that was forked by apt. Then the source of dpkg shows that the annoying soutput is only issued when isatty(1) is true. This is only the case when the fork uses pty instead pipe. Back to apt, there is a undocumented configuration variable that allows to use pipe instead pty which then solve the problem:

apt-get install -qq -o=Dpkg::Use-Pty=0 <packages>

Expecting that can help others.

share|improve this answer
Actually this is full correct answer. It's also allow to run apt-get with single -q and see some output and don't see annoying "Reading database" – valodzka Sep 30 '15 at 20:26
@valodzka Which ubuntu version are you on? On CircleCI (with Ubuntu 14.04) it steall reads (Reading database ... 625142 files and directories currently installed.). – koppor Jan 23 at 12:25
I tested it on Debian 8 – valodzka Jan 24 at 7:11
I tried this with Ubuntu 14.04 based Docker build and it doesn't work for me. – Cameron Taggart Mar 10 at 0:44
I'm trying this on gcloud debian jessie (8) and I still get reading database lines and unpacking/setting up lines. – CrazyCasta Jun 21 at 0:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.