0

I'm trying to create a script that upon booting up Ubuntu it opens up a terminal which runs sudo apt update && sudo apt upgrade -y. I managed to make said script, how I can open a terminal upon boot/reboot and make it run the script? Thanks in advance for the help!

2

1 Answer 1

0

If you're doing it "at startup", you're already running as UID 0, so use of sudo is incorrect and shoule be removed.

Also, "at startup" is the wrong environment to run apt (documented as It is intended as an end user interface and enables some options better suited for interactive usage by default. Use apt-get instead. Thus:

apt-get -q=2 -y update && apt-get -q=2 -y upgrade

is closer to what you want. Read man apt-get or https://manpages.ubuntu.com/manpages/bionic/en/man8/apt-get.8.html

4
  • What does -q=2 or --q=2 respectively and -y do?
    – dessert
    Apr 14, 2019 at 6:44
  • @dessert you can find that info using man apt-get as was suggested in the answer -- it says that -q means "quiet" and -y means "automatic yes to prompts". See man apt-get for more details.
    – Elias
    Apr 14, 2019 at 7:10
  • @Elias There is no option --q and what the proposed command does should definitely be part of the answer.
    – dessert
    Apr 14, 2019 at 7:14
  • I see... do I write these commands as a script then? Apr 14, 2019 at 17:56

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.