A new command combining apt update && apt upgrade in 18.04 or some later beta?












3














If I'm not wrong there's a new command unifying apt update && apt upgrade in 18.04 or some later beta, with some argument -u or -d.



Am I correct, or there is something similar?










share|improve this question




















  • 1




    dude, that would be so cool... what is the full command?
    – Joshua Besneatte
    Sep 21 at 1:14










  • I just did update/upgrade individually trying both flags. update using either flag did not auto-upgrade and upgrade using those flags did not auto update... hrm
    – Joshua Besneatte
    Sep 21 at 1:20










  • Hmm, I once saw a mentioning about this in a post here but I didn't find that post...
    – JohnDoea
    Sep 21 at 1:21










  • that would be so cool... I hope you figure it out!
    – Joshua Besneatte
    Sep 21 at 1:24






  • 4




    You could just make a bash alias for it.
    – FortuneCookie101
    Sep 23 at 3:41
















3














If I'm not wrong there's a new command unifying apt update && apt upgrade in 18.04 or some later beta, with some argument -u or -d.



Am I correct, or there is something similar?










share|improve this question




















  • 1




    dude, that would be so cool... what is the full command?
    – Joshua Besneatte
    Sep 21 at 1:14










  • I just did update/upgrade individually trying both flags. update using either flag did not auto-upgrade and upgrade using those flags did not auto update... hrm
    – Joshua Besneatte
    Sep 21 at 1:20










  • Hmm, I once saw a mentioning about this in a post here but I didn't find that post...
    – JohnDoea
    Sep 21 at 1:21










  • that would be so cool... I hope you figure it out!
    – Joshua Besneatte
    Sep 21 at 1:24






  • 4




    You could just make a bash alias for it.
    – FortuneCookie101
    Sep 23 at 3:41














3












3








3


6





If I'm not wrong there's a new command unifying apt update && apt upgrade in 18.04 or some later beta, with some argument -u or -d.



Am I correct, or there is something similar?










share|improve this question















If I'm not wrong there's a new command unifying apt update && apt upgrade in 18.04 or some later beta, with some argument -u or -d.



Am I correct, or there is something similar?







command-line apt updates






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 10 at 14:36

























asked Sep 21 at 1:07









JohnDoea

6592258




6592258








  • 1




    dude, that would be so cool... what is the full command?
    – Joshua Besneatte
    Sep 21 at 1:14










  • I just did update/upgrade individually trying both flags. update using either flag did not auto-upgrade and upgrade using those flags did not auto update... hrm
    – Joshua Besneatte
    Sep 21 at 1:20










  • Hmm, I once saw a mentioning about this in a post here but I didn't find that post...
    – JohnDoea
    Sep 21 at 1:21










  • that would be so cool... I hope you figure it out!
    – Joshua Besneatte
    Sep 21 at 1:24






  • 4




    You could just make a bash alias for it.
    – FortuneCookie101
    Sep 23 at 3:41














  • 1




    dude, that would be so cool... what is the full command?
    – Joshua Besneatte
    Sep 21 at 1:14










  • I just did update/upgrade individually trying both flags. update using either flag did not auto-upgrade and upgrade using those flags did not auto update... hrm
    – Joshua Besneatte
    Sep 21 at 1:20










  • Hmm, I once saw a mentioning about this in a post here but I didn't find that post...
    – JohnDoea
    Sep 21 at 1:21










  • that would be so cool... I hope you figure it out!
    – Joshua Besneatte
    Sep 21 at 1:24






  • 4




    You could just make a bash alias for it.
    – FortuneCookie101
    Sep 23 at 3:41








1




1




dude, that would be so cool... what is the full command?
– Joshua Besneatte
Sep 21 at 1:14




dude, that would be so cool... what is the full command?
– Joshua Besneatte
Sep 21 at 1:14












I just did update/upgrade individually trying both flags. update using either flag did not auto-upgrade and upgrade using those flags did not auto update... hrm
– Joshua Besneatte
Sep 21 at 1:20




I just did update/upgrade individually trying both flags. update using either flag did not auto-upgrade and upgrade using those flags did not auto update... hrm
– Joshua Besneatte
Sep 21 at 1:20












Hmm, I once saw a mentioning about this in a post here but I didn't find that post...
– JohnDoea
Sep 21 at 1:21




Hmm, I once saw a mentioning about this in a post here but I didn't find that post...
– JohnDoea
Sep 21 at 1:21












that would be so cool... I hope you figure it out!
– Joshua Besneatte
Sep 21 at 1:24




that would be so cool... I hope you figure it out!
– Joshua Besneatte
Sep 21 at 1:24




4




4




You could just make a bash alias for it.
– FortuneCookie101
Sep 23 at 3:41




You could just make a bash alias for it.
– FortuneCookie101
Sep 23 at 3:41










5 Answers
5






active

oldest

votes


















5














This is a pending feature request (LP#1709603), and as far as I can tell there has been no development activity on it (neither on Ubuntu nor on Debian).





There is an implemented feature that automatically runs an update when adding a PPA using add-apt-repository, though (and associated options, which have changed as this behaviour is now the default).






share|improve this answer































    6














    Set in terminal with command alias your new defined command for this like for example :



    alias update='sudo apt-get update && sudo apt-get dist-upgrade'


    Then you have your new command "update" and you can lean back, when typed "update" in terminal.






    share|improve this answer



















    • 3




      @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
      – dschinn1001
      Sep 23 at 21:36










    • But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
      – Joe
      Sep 27 at 6:35



















    4














    I doubt that that change will be included, unfortunately, but you can do something similar to the other answers-so-far, with some extra niceties.



    A script at /usr/local/bin/update



    This has the following nice benefits that the other answers-so-far don't have:




    • This completely avoids the problem that if sudo apt-get update takes a while, sudo apt-get upgrade might ask you for your password again, so you come back from your lunch break expecting upgraded packages and now you have to wait for a while for them to download and install.

    • This lets you know if a restart is required (like if you get a new kernel).

    • This works for all sudo users, not just you.

    • This does many more package-upgrading-related tasks than just sudo apt update && sudo apt upgrade, like upgrading the BIOS on some systems and upgrading snaps.


    I posted this elsewhere a while back, so I'll include it here.





    1. Open a terminal (press Ctrl+Alt+T) and run:



      sudo touch /usr/local/bin/update
      sudo chmod 0755 /usr/local/bin/update
      sudo nano /usr/local/bin/update



    2. Paste the following into the terminal:



      #!/bin/bash

      if [ "$( /usr/bin/id -u )" -ne "0" ] ; then
      echo 'Please run using sudo.'
      exit 1
      fi
      set +e
      /bin/rm -f /var/cache/app-info/xmls/fwupd.xml
      /usr/bin/snap refresh
      /usr/bin/apt update
      /usr/bin/appstreamcli refresh --force
      /usr/bin/apt-file update
      /usr/bin/apt full-upgrade -y
      /usr/bin/apt autoremove --purge -y
      /usr/bin/apt clean
      /usr/bin/fwupdmgr refresh
      /usr/bin/fwupdmgr update
      /usr/bin/updatedb
      /sbin/fstrim --all
      /usr/lib/update-notifier/update-motd-reboot-required


    3. Read the section below about things that you might want to change. Make any changes you feel like.


    4. Press Ctrl+O to save the file. That's the letter O, not zero.

    5. Press Enter to accept the filename.

    6. Press Ctrl+X to exit nano.


    Now you can run it with:



    sudo update


    Things that you might want to change



    Feel free to customize anything in it that you don't like. You can even add new commands to it to do additional upgrade-related housekeeping tasks.



    Note that this uses apt full-upgrade rather than apt upgrade, which can remove packages. It also uses apt autoremove --purge which removes packages that are supposedly no longer needed (like any kernels older than the latest two) along with their configuration files.



    Note also that none of the lines requires sudo because we're running the entire script with sudo, so leave that out.



    Here are what the commands do:




    • Requires running the script with sudo (the if-fi block).

    • Continues on to further commands even if there's an error in one command (set +e).

    • Deletes the firmware (e.g., BIOS) update metadata, because it's giving me AppStream errors (we download it fresh below, so this isn't as problematic as it initially appears to be).

    • Updates your snaps to their latest versions.

    • Updates the APT package information.

    • Updates the AppStream metadata.

    • Updates apt-file's metadata. apt-file list package-name is a nice way of finding out what files a package installs (alternatively, dpkg -S /path/to/file is a nice way of finding out which package a file belongs to).

    • Does an APT full-upgrade.

    • Removes newly-unnecessary packages and their configuration files.

    • Deletes any APT package files that were downloaded and left behind.

    • Updates the firmware update metadata.

    • Installs any new firmware updates.

    • Updates the locate command's (a fast way to find files outside of /home) database with the filenames that exist now after all the above updates.

    • TRIMs any SSDs. TRIM notifies the SSD itself about disk space that isn't used anymore (e.g., space that was used by deleted files). This helps it to do wear-leveling better.

    • Displays a restart needed notice if a restart is needed (e.g., after a new kernel is installed).






    share|improve this answer























    • Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
      – Joe
      Sep 27 at 6:49












    • dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
      – Joe
      Sep 27 at 6:58



















    3





    +50









    Edit your ~/.bashrc file and add this:



    update () {
    sudo apt-get update
    sudo apt-get upgrade "$@"
    }


    Save the file, close any open terminal(s) and open a new terminal.



    Test from the command line like this:



    $ update -s
    Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
    Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
    Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
    Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial InRelease
    Hit:5 http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu xenial InRelease
    Hit:6 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease
    Hit:7 http://dl.google.com/linux/chrome/deb stable Release
    Hit:9 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease
    Hit:10 http://ppa.launchpad.net/peek-developers/stable/ubuntu xenial InRelease
    Hit:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
    Reading package lists... Done
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Calculating upgrade... Done
    The following packages will be upgraded:
    binutils google-chrome-stable
    2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
    Inst google-chrome-stable [69.0.3497.92-1] (69.0.3497.100-1 Google:1.0/stable [amd64])
    Inst binutils [2.26.1-1ubuntu1~16.04.6] (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])
    Conf google-chrome-stable (69.0.3497.100-1 Google:1.0/stable [amd64])
    Conf binutils (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])


    You will be prompted for your password if you haven't used the sudo command in awhile.






    share|improve this answer























    • "$@" is an array ins't it? I don't understand why we need it there.
      – JohnDoea
      Sep 27 at 16:42










    • @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
      – WinEunuuchs2Unix
      Sep 28 at 1:56



















    0














    Another option that I use quite frequently for user-specific scripting is simply:



    cd 
    mkdir bin
    cd bin
    nano up


    Basically you're making a bin folder that bash looks for in every user and refreshes when you reboot. All you need for a simple update script like you're talking about, is this:




    #!/bin/bash
    echo "System Upgrade Commencing!"
    sudo apt update
    sudo apt upgrade
    echo "System Upgrade Complete!"



    CTRL+X, Y, ENTER



    up


    And voila. Simple script for updates and upgrades. Personally I add a lot more to my scripts for automation, such as "sudo apt upgrade -y", uptime, date and other tools for post-upgrade "sudo apt autoremove", "sudo apt autoclean" etc. You can also add some complexity by checking for packages that have been improperly installed if you want to query DPKG for possible errors, check your hard disk for faults, or list out the current processes running on your machine. Scripting is a free land of adventure and joy, good luck and have fun.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1077086%2fa-new-command-combining-apt-update-apt-upgrade-in-18-04-or-some-later-beta%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      5














      This is a pending feature request (LP#1709603), and as far as I can tell there has been no development activity on it (neither on Ubuntu nor on Debian).





      There is an implemented feature that automatically runs an update when adding a PPA using add-apt-repository, though (and associated options, which have changed as this behaviour is now the default).






      share|improve this answer




























        5














        This is a pending feature request (LP#1709603), and as far as I can tell there has been no development activity on it (neither on Ubuntu nor on Debian).





        There is an implemented feature that automatically runs an update when adding a PPA using add-apt-repository, though (and associated options, which have changed as this behaviour is now the default).






        share|improve this answer


























          5












          5








          5






          This is a pending feature request (LP#1709603), and as far as I can tell there has been no development activity on it (neither on Ubuntu nor on Debian).





          There is an implemented feature that automatically runs an update when adding a PPA using add-apt-repository, though (and associated options, which have changed as this behaviour is now the default).






          share|improve this answer














          This is a pending feature request (LP#1709603), and as far as I can tell there has been no development activity on it (neither on Ubuntu nor on Debian).





          There is an implemented feature that automatically runs an update when adding a PPA using add-apt-repository, though (and associated options, which have changed as this behaviour is now the default).







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 24 at 2:58

























          answered Sep 24 at 2:53









          muru

          1




          1

























              6














              Set in terminal with command alias your new defined command for this like for example :



              alias update='sudo apt-get update && sudo apt-get dist-upgrade'


              Then you have your new command "update" and you can lean back, when typed "update" in terminal.






              share|improve this answer



















              • 3




                @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
                – dschinn1001
                Sep 23 at 21:36










              • But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
                – Joe
                Sep 27 at 6:35
















              6














              Set in terminal with command alias your new defined command for this like for example :



              alias update='sudo apt-get update && sudo apt-get dist-upgrade'


              Then you have your new command "update" and you can lean back, when typed "update" in terminal.






              share|improve this answer



















              • 3




                @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
                – dschinn1001
                Sep 23 at 21:36










              • But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
                – Joe
                Sep 27 at 6:35














              6












              6








              6






              Set in terminal with command alias your new defined command for this like for example :



              alias update='sudo apt-get update && sudo apt-get dist-upgrade'


              Then you have your new command "update" and you can lean back, when typed "update" in terminal.






              share|improve this answer














              Set in terminal with command alias your new defined command for this like for example :



              alias update='sudo apt-get update && sudo apt-get dist-upgrade'


              Then you have your new command "update" and you can lean back, when typed "update" in terminal.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 26 at 8:22









              karel

              56.9k11127146




              56.9k11127146










              answered Sep 23 at 21:34









              dschinn1001

              2,20931734




              2,20931734








              • 3




                @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
                – dschinn1001
                Sep 23 at 21:36










              • But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
                – Joe
                Sep 27 at 6:35














              • 3




                @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
                – dschinn1001
                Sep 23 at 21:36










              • But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
                – Joe
                Sep 27 at 6:35








              3




              3




              @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
              – dschinn1001
              Sep 23 at 21:36




              @JohnDoea - from time to time, but not always - you should do : sudo apt-get autoremove
              – dschinn1001
              Sep 23 at 21:36












              But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
              – Joe
              Sep 27 at 6:35




              But, you need to add this alias to $HOME/.bashrc or $HOME/.bash_aliases if it exists so that it will be defined in any new shells you open and the next time you login.
              – Joe
              Sep 27 at 6:35











              4














              I doubt that that change will be included, unfortunately, but you can do something similar to the other answers-so-far, with some extra niceties.



              A script at /usr/local/bin/update



              This has the following nice benefits that the other answers-so-far don't have:




              • This completely avoids the problem that if sudo apt-get update takes a while, sudo apt-get upgrade might ask you for your password again, so you come back from your lunch break expecting upgraded packages and now you have to wait for a while for them to download and install.

              • This lets you know if a restart is required (like if you get a new kernel).

              • This works for all sudo users, not just you.

              • This does many more package-upgrading-related tasks than just sudo apt update && sudo apt upgrade, like upgrading the BIOS on some systems and upgrading snaps.


              I posted this elsewhere a while back, so I'll include it here.





              1. Open a terminal (press Ctrl+Alt+T) and run:



                sudo touch /usr/local/bin/update
                sudo chmod 0755 /usr/local/bin/update
                sudo nano /usr/local/bin/update



              2. Paste the following into the terminal:



                #!/bin/bash

                if [ "$( /usr/bin/id -u )" -ne "0" ] ; then
                echo 'Please run using sudo.'
                exit 1
                fi
                set +e
                /bin/rm -f /var/cache/app-info/xmls/fwupd.xml
                /usr/bin/snap refresh
                /usr/bin/apt update
                /usr/bin/appstreamcli refresh --force
                /usr/bin/apt-file update
                /usr/bin/apt full-upgrade -y
                /usr/bin/apt autoremove --purge -y
                /usr/bin/apt clean
                /usr/bin/fwupdmgr refresh
                /usr/bin/fwupdmgr update
                /usr/bin/updatedb
                /sbin/fstrim --all
                /usr/lib/update-notifier/update-motd-reboot-required


              3. Read the section below about things that you might want to change. Make any changes you feel like.


              4. Press Ctrl+O to save the file. That's the letter O, not zero.

              5. Press Enter to accept the filename.

              6. Press Ctrl+X to exit nano.


              Now you can run it with:



              sudo update


              Things that you might want to change



              Feel free to customize anything in it that you don't like. You can even add new commands to it to do additional upgrade-related housekeeping tasks.



              Note that this uses apt full-upgrade rather than apt upgrade, which can remove packages. It also uses apt autoremove --purge which removes packages that are supposedly no longer needed (like any kernels older than the latest two) along with their configuration files.



              Note also that none of the lines requires sudo because we're running the entire script with sudo, so leave that out.



              Here are what the commands do:




              • Requires running the script with sudo (the if-fi block).

              • Continues on to further commands even if there's an error in one command (set +e).

              • Deletes the firmware (e.g., BIOS) update metadata, because it's giving me AppStream errors (we download it fresh below, so this isn't as problematic as it initially appears to be).

              • Updates your snaps to their latest versions.

              • Updates the APT package information.

              • Updates the AppStream metadata.

              • Updates apt-file's metadata. apt-file list package-name is a nice way of finding out what files a package installs (alternatively, dpkg -S /path/to/file is a nice way of finding out which package a file belongs to).

              • Does an APT full-upgrade.

              • Removes newly-unnecessary packages and their configuration files.

              • Deletes any APT package files that were downloaded and left behind.

              • Updates the firmware update metadata.

              • Installs any new firmware updates.

              • Updates the locate command's (a fast way to find files outside of /home) database with the filenames that exist now after all the above updates.

              • TRIMs any SSDs. TRIM notifies the SSD itself about disk space that isn't used anymore (e.g., space that was used by deleted files). This helps it to do wear-leveling better.

              • Displays a restart needed notice if a restart is needed (e.g., after a new kernel is installed).






              share|improve this answer























              • Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
                – Joe
                Sep 27 at 6:49












              • dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
                – Joe
                Sep 27 at 6:58
















              4














              I doubt that that change will be included, unfortunately, but you can do something similar to the other answers-so-far, with some extra niceties.



              A script at /usr/local/bin/update



              This has the following nice benefits that the other answers-so-far don't have:




              • This completely avoids the problem that if sudo apt-get update takes a while, sudo apt-get upgrade might ask you for your password again, so you come back from your lunch break expecting upgraded packages and now you have to wait for a while for them to download and install.

              • This lets you know if a restart is required (like if you get a new kernel).

              • This works for all sudo users, not just you.

              • This does many more package-upgrading-related tasks than just sudo apt update && sudo apt upgrade, like upgrading the BIOS on some systems and upgrading snaps.


              I posted this elsewhere a while back, so I'll include it here.





              1. Open a terminal (press Ctrl+Alt+T) and run:



                sudo touch /usr/local/bin/update
                sudo chmod 0755 /usr/local/bin/update
                sudo nano /usr/local/bin/update



              2. Paste the following into the terminal:



                #!/bin/bash

                if [ "$( /usr/bin/id -u )" -ne "0" ] ; then
                echo 'Please run using sudo.'
                exit 1
                fi
                set +e
                /bin/rm -f /var/cache/app-info/xmls/fwupd.xml
                /usr/bin/snap refresh
                /usr/bin/apt update
                /usr/bin/appstreamcli refresh --force
                /usr/bin/apt-file update
                /usr/bin/apt full-upgrade -y
                /usr/bin/apt autoremove --purge -y
                /usr/bin/apt clean
                /usr/bin/fwupdmgr refresh
                /usr/bin/fwupdmgr update
                /usr/bin/updatedb
                /sbin/fstrim --all
                /usr/lib/update-notifier/update-motd-reboot-required


              3. Read the section below about things that you might want to change. Make any changes you feel like.


              4. Press Ctrl+O to save the file. That's the letter O, not zero.

              5. Press Enter to accept the filename.

              6. Press Ctrl+X to exit nano.


              Now you can run it with:



              sudo update


              Things that you might want to change



              Feel free to customize anything in it that you don't like. You can even add new commands to it to do additional upgrade-related housekeeping tasks.



              Note that this uses apt full-upgrade rather than apt upgrade, which can remove packages. It also uses apt autoremove --purge which removes packages that are supposedly no longer needed (like any kernels older than the latest two) along with their configuration files.



              Note also that none of the lines requires sudo because we're running the entire script with sudo, so leave that out.



              Here are what the commands do:




              • Requires running the script with sudo (the if-fi block).

              • Continues on to further commands even if there's an error in one command (set +e).

              • Deletes the firmware (e.g., BIOS) update metadata, because it's giving me AppStream errors (we download it fresh below, so this isn't as problematic as it initially appears to be).

              • Updates your snaps to their latest versions.

              • Updates the APT package information.

              • Updates the AppStream metadata.

              • Updates apt-file's metadata. apt-file list package-name is a nice way of finding out what files a package installs (alternatively, dpkg -S /path/to/file is a nice way of finding out which package a file belongs to).

              • Does an APT full-upgrade.

              • Removes newly-unnecessary packages and their configuration files.

              • Deletes any APT package files that were downloaded and left behind.

              • Updates the firmware update metadata.

              • Installs any new firmware updates.

              • Updates the locate command's (a fast way to find files outside of /home) database with the filenames that exist now after all the above updates.

              • TRIMs any SSDs. TRIM notifies the SSD itself about disk space that isn't used anymore (e.g., space that was used by deleted files). This helps it to do wear-leveling better.

              • Displays a restart needed notice if a restart is needed (e.g., after a new kernel is installed).






              share|improve this answer























              • Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
                – Joe
                Sep 27 at 6:49












              • dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
                – Joe
                Sep 27 at 6:58














              4












              4








              4






              I doubt that that change will be included, unfortunately, but you can do something similar to the other answers-so-far, with some extra niceties.



              A script at /usr/local/bin/update



              This has the following nice benefits that the other answers-so-far don't have:




              • This completely avoids the problem that if sudo apt-get update takes a while, sudo apt-get upgrade might ask you for your password again, so you come back from your lunch break expecting upgraded packages and now you have to wait for a while for them to download and install.

              • This lets you know if a restart is required (like if you get a new kernel).

              • This works for all sudo users, not just you.

              • This does many more package-upgrading-related tasks than just sudo apt update && sudo apt upgrade, like upgrading the BIOS on some systems and upgrading snaps.


              I posted this elsewhere a while back, so I'll include it here.





              1. Open a terminal (press Ctrl+Alt+T) and run:



                sudo touch /usr/local/bin/update
                sudo chmod 0755 /usr/local/bin/update
                sudo nano /usr/local/bin/update



              2. Paste the following into the terminal:



                #!/bin/bash

                if [ "$( /usr/bin/id -u )" -ne "0" ] ; then
                echo 'Please run using sudo.'
                exit 1
                fi
                set +e
                /bin/rm -f /var/cache/app-info/xmls/fwupd.xml
                /usr/bin/snap refresh
                /usr/bin/apt update
                /usr/bin/appstreamcli refresh --force
                /usr/bin/apt-file update
                /usr/bin/apt full-upgrade -y
                /usr/bin/apt autoremove --purge -y
                /usr/bin/apt clean
                /usr/bin/fwupdmgr refresh
                /usr/bin/fwupdmgr update
                /usr/bin/updatedb
                /sbin/fstrim --all
                /usr/lib/update-notifier/update-motd-reboot-required


              3. Read the section below about things that you might want to change. Make any changes you feel like.


              4. Press Ctrl+O to save the file. That's the letter O, not zero.

              5. Press Enter to accept the filename.

              6. Press Ctrl+X to exit nano.


              Now you can run it with:



              sudo update


              Things that you might want to change



              Feel free to customize anything in it that you don't like. You can even add new commands to it to do additional upgrade-related housekeeping tasks.



              Note that this uses apt full-upgrade rather than apt upgrade, which can remove packages. It also uses apt autoremove --purge which removes packages that are supposedly no longer needed (like any kernels older than the latest two) along with their configuration files.



              Note also that none of the lines requires sudo because we're running the entire script with sudo, so leave that out.



              Here are what the commands do:




              • Requires running the script with sudo (the if-fi block).

              • Continues on to further commands even if there's an error in one command (set +e).

              • Deletes the firmware (e.g., BIOS) update metadata, because it's giving me AppStream errors (we download it fresh below, so this isn't as problematic as it initially appears to be).

              • Updates your snaps to their latest versions.

              • Updates the APT package information.

              • Updates the AppStream metadata.

              • Updates apt-file's metadata. apt-file list package-name is a nice way of finding out what files a package installs (alternatively, dpkg -S /path/to/file is a nice way of finding out which package a file belongs to).

              • Does an APT full-upgrade.

              • Removes newly-unnecessary packages and their configuration files.

              • Deletes any APT package files that were downloaded and left behind.

              • Updates the firmware update metadata.

              • Installs any new firmware updates.

              • Updates the locate command's (a fast way to find files outside of /home) database with the filenames that exist now after all the above updates.

              • TRIMs any SSDs. TRIM notifies the SSD itself about disk space that isn't used anymore (e.g., space that was used by deleted files). This helps it to do wear-leveling better.

              • Displays a restart needed notice if a restart is needed (e.g., after a new kernel is installed).






              share|improve this answer














              I doubt that that change will be included, unfortunately, but you can do something similar to the other answers-so-far, with some extra niceties.



              A script at /usr/local/bin/update



              This has the following nice benefits that the other answers-so-far don't have:




              • This completely avoids the problem that if sudo apt-get update takes a while, sudo apt-get upgrade might ask you for your password again, so you come back from your lunch break expecting upgraded packages and now you have to wait for a while for them to download and install.

              • This lets you know if a restart is required (like if you get a new kernel).

              • This works for all sudo users, not just you.

              • This does many more package-upgrading-related tasks than just sudo apt update && sudo apt upgrade, like upgrading the BIOS on some systems and upgrading snaps.


              I posted this elsewhere a while back, so I'll include it here.





              1. Open a terminal (press Ctrl+Alt+T) and run:



                sudo touch /usr/local/bin/update
                sudo chmod 0755 /usr/local/bin/update
                sudo nano /usr/local/bin/update



              2. Paste the following into the terminal:



                #!/bin/bash

                if [ "$( /usr/bin/id -u )" -ne "0" ] ; then
                echo 'Please run using sudo.'
                exit 1
                fi
                set +e
                /bin/rm -f /var/cache/app-info/xmls/fwupd.xml
                /usr/bin/snap refresh
                /usr/bin/apt update
                /usr/bin/appstreamcli refresh --force
                /usr/bin/apt-file update
                /usr/bin/apt full-upgrade -y
                /usr/bin/apt autoremove --purge -y
                /usr/bin/apt clean
                /usr/bin/fwupdmgr refresh
                /usr/bin/fwupdmgr update
                /usr/bin/updatedb
                /sbin/fstrim --all
                /usr/lib/update-notifier/update-motd-reboot-required


              3. Read the section below about things that you might want to change. Make any changes you feel like.


              4. Press Ctrl+O to save the file. That's the letter O, not zero.

              5. Press Enter to accept the filename.

              6. Press Ctrl+X to exit nano.


              Now you can run it with:



              sudo update


              Things that you might want to change



              Feel free to customize anything in it that you don't like. You can even add new commands to it to do additional upgrade-related housekeeping tasks.



              Note that this uses apt full-upgrade rather than apt upgrade, which can remove packages. It also uses apt autoremove --purge which removes packages that are supposedly no longer needed (like any kernels older than the latest two) along with their configuration files.



              Note also that none of the lines requires sudo because we're running the entire script with sudo, so leave that out.



              Here are what the commands do:




              • Requires running the script with sudo (the if-fi block).

              • Continues on to further commands even if there's an error in one command (set +e).

              • Deletes the firmware (e.g., BIOS) update metadata, because it's giving me AppStream errors (we download it fresh below, so this isn't as problematic as it initially appears to be).

              • Updates your snaps to their latest versions.

              • Updates the APT package information.

              • Updates the AppStream metadata.

              • Updates apt-file's metadata. apt-file list package-name is a nice way of finding out what files a package installs (alternatively, dpkg -S /path/to/file is a nice way of finding out which package a file belongs to).

              • Does an APT full-upgrade.

              • Removes newly-unnecessary packages and their configuration files.

              • Deletes any APT package files that were downloaded and left behind.

              • Updates the firmware update metadata.

              • Installs any new firmware updates.

              • Updates the locate command's (a fast way to find files outside of /home) database with the filenames that exist now after all the above updates.

              • TRIMs any SSDs. TRIM notifies the SSD itself about disk space that isn't used anymore (e.g., space that was used by deleted files). This helps it to do wear-leveling better.

              • Displays a restart needed notice if a restart is needed (e.g., after a new kernel is installed).







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 24 at 3:05

























              answered Sep 24 at 2:36









              Chai T. Rex

              4,00711333




              4,00711333












              • Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
                – Joe
                Sep 27 at 6:49












              • dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
                – Joe
                Sep 27 at 6:58


















              • Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
                – Joe
                Sep 27 at 6:49












              • dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
                – Joe
                Sep 27 at 6:58
















              Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
              – Joe
              Sep 27 at 6:49






              Nice. Although, last I looked, apt-file wasn't installed by default, so that would have to be installed to prevent the script from failing. Personally, I like to do things like this in separate steps so that if I notice anything unusual in one step, I can address that before potentially compounding a problem. Never noticed full-upgrade before. Did that replace dist-upgrade? I don't see the latter in man apt now.
              – Joe
              Sep 27 at 6:49














              dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
              – Joe
              Sep 27 at 6:58




              dist-upgrade shows up in man apt-get, but not in man apt. It appears to be a bit different than full-upgrade. It seems to have more leeway for uninstalling things to allow new installs, but I don't appreciate the subtleties of it.
              – Joe
              Sep 27 at 6:58











              3





              +50









              Edit your ~/.bashrc file and add this:



              update () {
              sudo apt-get update
              sudo apt-get upgrade "$@"
              }


              Save the file, close any open terminal(s) and open a new terminal.



              Test from the command line like this:



              $ update -s
              Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
              Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
              Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
              Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial InRelease
              Hit:5 http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu xenial InRelease
              Hit:6 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease
              Hit:7 http://dl.google.com/linux/chrome/deb stable Release
              Hit:9 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease
              Hit:10 http://ppa.launchpad.net/peek-developers/stable/ubuntu xenial InRelease
              Hit:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
              Reading package lists... Done
              Reading package lists... Done
              Building dependency tree
              Reading state information... Done
              Calculating upgrade... Done
              The following packages will be upgraded:
              binutils google-chrome-stable
              2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
              Inst google-chrome-stable [69.0.3497.92-1] (69.0.3497.100-1 Google:1.0/stable [amd64])
              Inst binutils [2.26.1-1ubuntu1~16.04.6] (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])
              Conf google-chrome-stable (69.0.3497.100-1 Google:1.0/stable [amd64])
              Conf binutils (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])


              You will be prompted for your password if you haven't used the sudo command in awhile.






              share|improve this answer























              • "$@" is an array ins't it? I don't understand why we need it there.
                – JohnDoea
                Sep 27 at 16:42










              • @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
                – WinEunuuchs2Unix
                Sep 28 at 1:56
















              3





              +50









              Edit your ~/.bashrc file and add this:



              update () {
              sudo apt-get update
              sudo apt-get upgrade "$@"
              }


              Save the file, close any open terminal(s) and open a new terminal.



              Test from the command line like this:



              $ update -s
              Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
              Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
              Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
              Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial InRelease
              Hit:5 http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu xenial InRelease
              Hit:6 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease
              Hit:7 http://dl.google.com/linux/chrome/deb stable Release
              Hit:9 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease
              Hit:10 http://ppa.launchpad.net/peek-developers/stable/ubuntu xenial InRelease
              Hit:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
              Reading package lists... Done
              Reading package lists... Done
              Building dependency tree
              Reading state information... Done
              Calculating upgrade... Done
              The following packages will be upgraded:
              binutils google-chrome-stable
              2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
              Inst google-chrome-stable [69.0.3497.92-1] (69.0.3497.100-1 Google:1.0/stable [amd64])
              Inst binutils [2.26.1-1ubuntu1~16.04.6] (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])
              Conf google-chrome-stable (69.0.3497.100-1 Google:1.0/stable [amd64])
              Conf binutils (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])


              You will be prompted for your password if you haven't used the sudo command in awhile.






              share|improve this answer























              • "$@" is an array ins't it? I don't understand why we need it there.
                – JohnDoea
                Sep 27 at 16:42










              • @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
                – WinEunuuchs2Unix
                Sep 28 at 1:56














              3





              +50







              3





              +50



              3




              +50




              Edit your ~/.bashrc file and add this:



              update () {
              sudo apt-get update
              sudo apt-get upgrade "$@"
              }


              Save the file, close any open terminal(s) and open a new terminal.



              Test from the command line like this:



              $ update -s
              Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
              Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
              Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
              Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial InRelease
              Hit:5 http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu xenial InRelease
              Hit:6 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease
              Hit:7 http://dl.google.com/linux/chrome/deb stable Release
              Hit:9 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease
              Hit:10 http://ppa.launchpad.net/peek-developers/stable/ubuntu xenial InRelease
              Hit:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
              Reading package lists... Done
              Reading package lists... Done
              Building dependency tree
              Reading state information... Done
              Calculating upgrade... Done
              The following packages will be upgraded:
              binutils google-chrome-stable
              2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
              Inst google-chrome-stable [69.0.3497.92-1] (69.0.3497.100-1 Google:1.0/stable [amd64])
              Inst binutils [2.26.1-1ubuntu1~16.04.6] (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])
              Conf google-chrome-stable (69.0.3497.100-1 Google:1.0/stable [amd64])
              Conf binutils (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])


              You will be prompted for your password if you haven't used the sudo command in awhile.






              share|improve this answer














              Edit your ~/.bashrc file and add this:



              update () {
              sudo apt-get update
              sudo apt-get upgrade "$@"
              }


              Save the file, close any open terminal(s) and open a new terminal.



              Test from the command line like this:



              $ update -s
              Hit:1 http://archive.canonical.com/ubuntu xenial InRelease
              Hit:2 http://security.ubuntu.com/ubuntu xenial-security InRelease
              Ign:3 http://dl.google.com/linux/chrome/deb stable InRelease
              Hit:4 http://ca.archive.ubuntu.com/ubuntu xenial InRelease
              Hit:5 http://ppa.launchpad.net/fossfreedom/indicator-sysmonitor/ubuntu xenial InRelease
              Hit:6 http://ca.archive.ubuntu.com/ubuntu xenial-updates InRelease
              Hit:7 http://dl.google.com/linux/chrome/deb stable Release
              Hit:9 http://ca.archive.ubuntu.com/ubuntu xenial-backports InRelease
              Hit:10 http://ppa.launchpad.net/peek-developers/stable/ubuntu xenial InRelease
              Hit:11 http://ppa.launchpad.net/webupd8team/java/ubuntu xenial InRelease
              Reading package lists... Done
              Reading package lists... Done
              Building dependency tree
              Reading state information... Done
              Calculating upgrade... Done
              The following packages will be upgraded:
              binutils google-chrome-stable
              2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
              Inst google-chrome-stable [69.0.3497.92-1] (69.0.3497.100-1 Google:1.0/stable [amd64])
              Inst binutils [2.26.1-1ubuntu1~16.04.6] (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])
              Conf google-chrome-stable (69.0.3497.100-1 Google:1.0/stable [amd64])
              Conf binutils (2.26.1-1ubuntu1~16.04.7 Ubuntu:16.04/xenial-updates [amd64])


              You will be prompted for your password if you haven't used the sudo command in awhile.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited Sep 24 at 1:59

























              answered Sep 24 at 1:54









              WinEunuuchs2Unix

              43.1k1075163




              43.1k1075163












              • "$@" is an array ins't it? I don't understand why we need it there.
                – JohnDoea
                Sep 27 at 16:42










              • @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
                – WinEunuuchs2Unix
                Sep 28 at 1:56


















              • "$@" is an array ins't it? I don't understand why we need it there.
                – JohnDoea
                Sep 27 at 16:42










              • @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
                – WinEunuuchs2Unix
                Sep 28 at 1:56
















              "$@" is an array ins't it? I don't understand why we need it there.
              – JohnDoea
              Sep 27 at 16:42




              "$@" is an array ins't it? I don't understand why we need it there.
              – JohnDoea
              Sep 27 at 16:42












              @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
              – WinEunuuchs2Unix
              Sep 28 at 1:56




              @JohnDoea "$@" is used for all array elements. "$*" is used for all array elements with array separators (for example I use | as array separator instead of space because my fields (array elements) often contain spaces). In bash / shell the $@ variable also links to all the parameters passed to a function. You narrow it down with $1 for first parameter, $2 for second parameter, etc. At least I think that's the way to explain it.
              – WinEunuuchs2Unix
              Sep 28 at 1:56











              0














              Another option that I use quite frequently for user-specific scripting is simply:



              cd 
              mkdir bin
              cd bin
              nano up


              Basically you're making a bin folder that bash looks for in every user and refreshes when you reboot. All you need for a simple update script like you're talking about, is this:




              #!/bin/bash
              echo "System Upgrade Commencing!"
              sudo apt update
              sudo apt upgrade
              echo "System Upgrade Complete!"



              CTRL+X, Y, ENTER



              up


              And voila. Simple script for updates and upgrades. Personally I add a lot more to my scripts for automation, such as "sudo apt upgrade -y", uptime, date and other tools for post-upgrade "sudo apt autoremove", "sudo apt autoclean" etc. You can also add some complexity by checking for packages that have been improperly installed if you want to query DPKG for possible errors, check your hard disk for faults, or list out the current processes running on your machine. Scripting is a free land of adventure and joy, good luck and have fun.






              share|improve this answer


























                0














                Another option that I use quite frequently for user-specific scripting is simply:



                cd 
                mkdir bin
                cd bin
                nano up


                Basically you're making a bin folder that bash looks for in every user and refreshes when you reboot. All you need for a simple update script like you're talking about, is this:




                #!/bin/bash
                echo "System Upgrade Commencing!"
                sudo apt update
                sudo apt upgrade
                echo "System Upgrade Complete!"



                CTRL+X, Y, ENTER



                up


                And voila. Simple script for updates and upgrades. Personally I add a lot more to my scripts for automation, such as "sudo apt upgrade -y", uptime, date and other tools for post-upgrade "sudo apt autoremove", "sudo apt autoclean" etc. You can also add some complexity by checking for packages that have been improperly installed if you want to query DPKG for possible errors, check your hard disk for faults, or list out the current processes running on your machine. Scripting is a free land of adventure and joy, good luck and have fun.






                share|improve this answer
























                  0












                  0








                  0






                  Another option that I use quite frequently for user-specific scripting is simply:



                  cd 
                  mkdir bin
                  cd bin
                  nano up


                  Basically you're making a bin folder that bash looks for in every user and refreshes when you reboot. All you need for a simple update script like you're talking about, is this:




                  #!/bin/bash
                  echo "System Upgrade Commencing!"
                  sudo apt update
                  sudo apt upgrade
                  echo "System Upgrade Complete!"



                  CTRL+X, Y, ENTER



                  up


                  And voila. Simple script for updates and upgrades. Personally I add a lot more to my scripts for automation, such as "sudo apt upgrade -y", uptime, date and other tools for post-upgrade "sudo apt autoremove", "sudo apt autoclean" etc. You can also add some complexity by checking for packages that have been improperly installed if you want to query DPKG for possible errors, check your hard disk for faults, or list out the current processes running on your machine. Scripting is a free land of adventure and joy, good luck and have fun.






                  share|improve this answer












                  Another option that I use quite frequently for user-specific scripting is simply:



                  cd 
                  mkdir bin
                  cd bin
                  nano up


                  Basically you're making a bin folder that bash looks for in every user and refreshes when you reboot. All you need for a simple update script like you're talking about, is this:




                  #!/bin/bash
                  echo "System Upgrade Commencing!"
                  sudo apt update
                  sudo apt upgrade
                  echo "System Upgrade Complete!"



                  CTRL+X, Y, ENTER



                  up


                  And voila. Simple script for updates and upgrades. Personally I add a lot more to my scripts for automation, such as "sudo apt upgrade -y", uptime, date and other tools for post-upgrade "sudo apt autoremove", "sudo apt autoclean" etc. You can also add some complexity by checking for packages that have been improperly installed if you want to query DPKG for possible errors, check your hard disk for faults, or list out the current processes running on your machine. Scripting is a free land of adventure and joy, good luck and have fun.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Sep 27 at 16:36









                  Tmanok

                  95




                  95






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1077086%2fa-new-command-combining-apt-update-apt-upgrade-in-18-04-or-some-later-beta%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Quarter-circle Tiles

                      build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                      Mont Emei