Super User is a question and answer site for computer enthusiasts and power users. 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

Is there a way to make apt-get install answer "yes" to the "Do you want to continue [y/N]?"?

share|improve this question
If you want, we can each post it a few more times, just to make sure you get the point. ;) – jrc03c Jul 16 '10 at 20:38
Yeah do that. I found the answer myself about 5 seconds after I posted this =/ It's Friday, I was answering the question for someone else and when I finally got to my computer, I posted it before I realized I just had to check the help. Thanks! – Mistiry Jul 16 '10 at 20:41
up vote 166 down vote accepted

via the apt-get man page:

apt-get -y install [packagename]
share|improve this answer

The problem with:

apt-get --yes install $something

is that it will ask for a manual confirmation if the package signature owner's public-key is not in the keyring, or some other conditions. to be sure it does not ask a confirmation just do this:

apt-get --yes --force-yes install $something

If you want to have these settings permanent, create a file in /etc/apt/apt.conf.d/, like /etc/apt/apt.conf.d/90forceyes with the following content:

APT::Get::Assume-Yes "true";
APT::Get::force-yes "true";
share|improve this answer
+1 for variety. All the -y were getting boring. (Plus it's a more complete answer.) – Dennis Williamson Jul 16 '10 at 23:30
+1 the best answer - I was looking for the solution to force yes, rather than having to specify it each time – Robin Winslow Oct 11 '12 at 12:15
Will this work when it says "To continue type in the phrase 'Yes, do as I say!'" too? If not what is the work-around then? I encounter this when trying to replace sysvinit with systemd in my chrooted debian image. – Lennart Rolland May 29 '15 at 19:38
Please don't ever use --force-yes: as this reply to a related thread on debian-devel suggests, --force-yes might render the system unusable. (I'm not downvoting because the answer actually addresses the problem as stated by the OP, but I'd add a BIG RED WARNING to the answer anyway.) – kostix Jun 10 '15 at 14:16
APT::Get::Assume-Yes "true"; helped me to avoid interrupt in an installation in a docker container. – Mehdi Sadeghi Feb 22 at 11:18

Note that if you also want to automatically go by the default answers when an interactive prompt appears, you can use DEBIAN_FRONTEND=noninteractive

Single install:

sudo DEBIAN_FRONTEND=noninteractive apt-get -y install [packagename]


sudo DEBIAN_FRONTEND=noninteractive apt-get -y install postfix

All updates:

sudo DEBIAN_FRONTEND=noninteractive apt-get -y update 

You can set up finer options with -o Dpkg::Options::="--force-confdef" and -o Dpkg::Options::="--force-confold".


apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"


apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade

Example of interactive prompt:

enter image description here

Interesting read: Perform an unattended installation of a Debian package

share|improve this answer
APT::Get::Assume-Yes "true";

APT::Get::force-yes "true";

This should at least be in /etc/apt/apt.conf and commented out. I worry Ubuntu is taking the Microsoft tack of always asking for permission.

"Are you sure?", of course I am sure, I am not a trained monkey simply typing away at the keyboard, going click happy.

Next the door will ask, "Are you sure you want to go outside?"
The oven will ask, "Are you sure you want to cook?"
The automobile will ask, "Are you sure you want to apply brakes?"
The fire extinguisher will ask, "Are you sure you want to put out the fire?"
I am sorry Dave, I can't let you do that.
HAL9000 could use a contraction but Data could not, or couldn't.

share|improve this answer
This is so the best answer – Robin Winslow Jan 21 '15 at 21:52
The difference with HAL9000 and dpkg asking for permission is that HAL said "no, period", whereas the "Yes, do as I say" thing only shows up if you're about to completely and utterly break your system. If that's what you want, sure, go ahead. But having a warning in that case seems reasonable. – Wouter Verhelst Jun 11 '15 at 13:41

From the apt-get HOWTO

Use the -y switch: apt-get -y install packagename

share|improve this answer
apt-get -y update
apt-get -y install [package]
share|improve this answer
+1 , but why update needs permission? – amyassin May 22 '12 at 20:31
@amyassin the apt-get update command requires root permissions because it updates the local package lists (indexes), which are system files owned by root. – jjmontes Oct 9 '15 at 11:31

generally the options from the manual should work well

apt-get -y --force-yes install package

if it does not succeed you can try to use the yes command.

yes | apt-get -y --force-yes install package

did use this with my vagrant shell provisioning script

PS: in case you want non-interactive but with generally stating no then you can try this:

yes no | apt-get install package
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .