I have a script which removes libreoffice and installs openoffice instead, how can I get apt-get to stop requiring the user to confirm this operation? I only want this to happen in the script so what switches should I use? I also want to reduce the output so it doesn't clog up the console.
Asked
Active
Viewed 1.4k times
1 Answers
16
You need to use apt-get --yes
. Quoting from the man page (man apt-get
):
-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
.
For example:
apt-get install --yes gedit
To reduce the output you can redirect it to /dev/null
(only errors will be shown):
apt-get install --yes gedit > /dev/null
To make it produce zero output (not even print errors):
apt-get install --yes gedit &> /dev/null
Then, if something goes wrong, you will be able to find information in /var/log/apt
.

Andrea Corbellini
- 15,826
stop user confirmation
means just install without responding as a yes to question whether you want it or not?sudo apt-get install AnyProgramYouWant -y
.-y
here means yes to all. – nickanor Dec 28 '12 at 19:21