How do I make apt-get install less noisy?

The man page for apt-get is as follows:

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

SYNOPSIS
       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


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.


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
$

Tags:

Apt