I am trying to write a bash script to install a list of software. I am using --assume-yes to get past the prompts.

This following line somehow doesn't work:

sudo apt-get install python-software-properties --assume-yes

If I try to apt-get without --assume-yes it works but the prompt asks me to:

please [Enter] to continue or ctrl+c to cancel adding it

How do I add Enter as a command when running apt-get install instead of using --assume-yes?


Your problem is that the option should be before the packages, not after, this is the correct syntax:

apt-get <options> command package=version/release

So, for it to work it should be:

sudo apt-get --assume-yes install python-software-properties

apt-get is forgiving when mixing up command and options, but to err on the safe side, you should always use the options before the command and never put options or commands after the name of the package.


Add -y flag to apt-get install <package-name> command like below, you won't get any prompt while installing packages.

sudo apt-get install -y <package-name>

From apt-get --help

-y  Assume Yes to all queries and do not prompt
  • Is there a difference between --assume-yes and -y? Nov 26 '17 at 17:39
  • 4
    @PeterMortensen they do the same thing. From the man page:-y, --yes, --assume-yes Automatic yes to prompts
    – davejagoda
    Dec 6 '17 at 18:59
  • 1
    Note that this may not be enough and you may also need to add -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" to your commands. See raphaelhertzog.com/2010/09/21/… for details.
    – TTimo
    Oct 10 '19 at 15:45
  • @TTimo Wow! 6 days after you posted that comment, I come along and find that's exactly the answer I needed!! If I could upvote your comment more I would!
    – Crimbo
    Oct 16 '19 at 7:00
  • Feel free to edit the answer with additional options. Oct 16 '19 at 7:09

For another silent and effective way as follows :

sudo DEBIAN_FRONTEND=noninteractive apt-get install -qq python-software-properties < /dev/null > /dev/null

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.