Ubuntu – redirecting apt and apt-get commands

aptbashcommand linepackage-management

When sudo apt-get install -y blender redirects to /dev/null , the installing process completed without any warnings or errors.

But when sudo apt install -y blender redirects to /dev/null , this warning is shown :

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

So what's difference between apt-get and apt commands that cause this warning ?

I know that it's better to use apt instead of apt-get, but how to redirect the apt output without this warning ?

Is there another way to make apt less noisy ? (beacause -q and -qq options are not silently as they be should)

Best Answer

If you are redirecting the output in order not to see it at all, then you can ignore the warning. It's intended to tell you that if you want to read the output later as a log, you can expect clearer information if you use apt-get, since some of the dynamic output from apt is not captured accurately.

Apparently APT is smart enough to realise you are redirecting its output but not to understand where you are sending it.

If you need to you can always read the logged output, by the way; it's automatically saved in /var/log/apt/term.log (and compressed and rotated when it gets old).

Related Question