Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

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.

share|improve this question
When you say 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
up vote 7 down vote accepted

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.

share|improve this answer

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.