How to remove disabled (unused) snap packages with a single line of command?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
4
down vote

favorite












When I run snap list --all command it shows all the installed versions of snap packages.



Name Version Rev Tracking Developer Notes
atom 1.26.1 150 stable snapcrafters classic
brave v0.22.669dev 23 stable brave -
core 16-2.32.6 4571 stable canonical core
core 16-2.32.5 4486 stable canonical core,disabled
firefox 59.0.2-1 71 stable mozilla disabled
firefox 60.0-2 85 stable mozilla -
gimp 2.10.0 38 stable snapcrafters disabled
gimp 2.10.0 39 stable snapcrafters -
gimp 2.8.22 30 stable snapcrafters disabled
gnome-3-26-1604 3.26.0 64 stable/… canonical -
gnome-3-26-1604 3.26.0 62 stable/… canonical disabled
gnome-characters 3.28.0 86 stable/… canonical -
gnome-characters 3.26.2 69 stable/… canonical disabled
gnome-logs 3.26.2 25 stable/… canonical disabled
gnome-logs 3.28.0 31 stable/… canonical -
gnome-system-monitor 3.26.0 36 stable/… canonical disabled
gnome-system-monitor 3.26.0 39 stable/… canonical -
libreoffice 6.0.3.2 59 stable canonical disabled
libreoffice 6.0.4.2 63 stable canonical -


Now there are so many disabled packages there which are no longer used. So I want to remove those packages. Here the command is snap remove gnome-3-26-1604 --revision=62 . Now I have to do it for all the revisions and for all the packages one by one. Is there any command which will remove the disabled or unused snap packages with single line of command?



Thanks in advance...







share|improve this question






















  • Would it be possible for you to edit your question and instead of an image do copy and paste of the text? It really is discouraged to have images unless absolutely needed. It helps us with helping you. Thanks!
    – Terrance
    May 15 at 17:49







  • 1




    Yeah sure!! I have edited the question...
    – Ryko
    May 16 at 8:47










  • Note that keeping a single previous version is by design: when a snap is updated, the older revision will be removed.
    – muru
    May 16 at 8:55










  • But here gimp has 3 versions (revision-30,38,39). Though revision 38 and 39 has same versions... I will inform you later when any of this apps get further updates...
    – Ryko
    May 17 at 4:41










  • Is there any settings available in snap so that I could disable keeping previous versions of the snap applications... Because some of them requires so much space... like libre-office takes in nearly 2GB of space, and if the previous version is included it becomes 4GB.
    – Ryko
    May 17 at 4:44














up vote
4
down vote

favorite












When I run snap list --all command it shows all the installed versions of snap packages.



Name Version Rev Tracking Developer Notes
atom 1.26.1 150 stable snapcrafters classic
brave v0.22.669dev 23 stable brave -
core 16-2.32.6 4571 stable canonical core
core 16-2.32.5 4486 stable canonical core,disabled
firefox 59.0.2-1 71 stable mozilla disabled
firefox 60.0-2 85 stable mozilla -
gimp 2.10.0 38 stable snapcrafters disabled
gimp 2.10.0 39 stable snapcrafters -
gimp 2.8.22 30 stable snapcrafters disabled
gnome-3-26-1604 3.26.0 64 stable/… canonical -
gnome-3-26-1604 3.26.0 62 stable/… canonical disabled
gnome-characters 3.28.0 86 stable/… canonical -
gnome-characters 3.26.2 69 stable/… canonical disabled
gnome-logs 3.26.2 25 stable/… canonical disabled
gnome-logs 3.28.0 31 stable/… canonical -
gnome-system-monitor 3.26.0 36 stable/… canonical disabled
gnome-system-monitor 3.26.0 39 stable/… canonical -
libreoffice 6.0.3.2 59 stable canonical disabled
libreoffice 6.0.4.2 63 stable canonical -


Now there are so many disabled packages there which are no longer used. So I want to remove those packages. Here the command is snap remove gnome-3-26-1604 --revision=62 . Now I have to do it for all the revisions and for all the packages one by one. Is there any command which will remove the disabled or unused snap packages with single line of command?



Thanks in advance...







share|improve this question






















  • Would it be possible for you to edit your question and instead of an image do copy and paste of the text? It really is discouraged to have images unless absolutely needed. It helps us with helping you. Thanks!
    – Terrance
    May 15 at 17:49







  • 1




    Yeah sure!! I have edited the question...
    – Ryko
    May 16 at 8:47










  • Note that keeping a single previous version is by design: when a snap is updated, the older revision will be removed.
    – muru
    May 16 at 8:55










  • But here gimp has 3 versions (revision-30,38,39). Though revision 38 and 39 has same versions... I will inform you later when any of this apps get further updates...
    – Ryko
    May 17 at 4:41










  • Is there any settings available in snap so that I could disable keeping previous versions of the snap applications... Because some of them requires so much space... like libre-office takes in nearly 2GB of space, and if the previous version is included it becomes 4GB.
    – Ryko
    May 17 at 4:44












up vote
4
down vote

favorite









up vote
4
down vote

favorite











When I run snap list --all command it shows all the installed versions of snap packages.



Name Version Rev Tracking Developer Notes
atom 1.26.1 150 stable snapcrafters classic
brave v0.22.669dev 23 stable brave -
core 16-2.32.6 4571 stable canonical core
core 16-2.32.5 4486 stable canonical core,disabled
firefox 59.0.2-1 71 stable mozilla disabled
firefox 60.0-2 85 stable mozilla -
gimp 2.10.0 38 stable snapcrafters disabled
gimp 2.10.0 39 stable snapcrafters -
gimp 2.8.22 30 stable snapcrafters disabled
gnome-3-26-1604 3.26.0 64 stable/… canonical -
gnome-3-26-1604 3.26.0 62 stable/… canonical disabled
gnome-characters 3.28.0 86 stable/… canonical -
gnome-characters 3.26.2 69 stable/… canonical disabled
gnome-logs 3.26.2 25 stable/… canonical disabled
gnome-logs 3.28.0 31 stable/… canonical -
gnome-system-monitor 3.26.0 36 stable/… canonical disabled
gnome-system-monitor 3.26.0 39 stable/… canonical -
libreoffice 6.0.3.2 59 stable canonical disabled
libreoffice 6.0.4.2 63 stable canonical -


Now there are so many disabled packages there which are no longer used. So I want to remove those packages. Here the command is snap remove gnome-3-26-1604 --revision=62 . Now I have to do it for all the revisions and for all the packages one by one. Is there any command which will remove the disabled or unused snap packages with single line of command?



Thanks in advance...







share|improve this question














When I run snap list --all command it shows all the installed versions of snap packages.



Name Version Rev Tracking Developer Notes
atom 1.26.1 150 stable snapcrafters classic
brave v0.22.669dev 23 stable brave -
core 16-2.32.6 4571 stable canonical core
core 16-2.32.5 4486 stable canonical core,disabled
firefox 59.0.2-1 71 stable mozilla disabled
firefox 60.0-2 85 stable mozilla -
gimp 2.10.0 38 stable snapcrafters disabled
gimp 2.10.0 39 stable snapcrafters -
gimp 2.8.22 30 stable snapcrafters disabled
gnome-3-26-1604 3.26.0 64 stable/… canonical -
gnome-3-26-1604 3.26.0 62 stable/… canonical disabled
gnome-characters 3.28.0 86 stable/… canonical -
gnome-characters 3.26.2 69 stable/… canonical disabled
gnome-logs 3.26.2 25 stable/… canonical disabled
gnome-logs 3.28.0 31 stable/… canonical -
gnome-system-monitor 3.26.0 36 stable/… canonical disabled
gnome-system-monitor 3.26.0 39 stable/… canonical -
libreoffice 6.0.3.2 59 stable canonical disabled
libreoffice 6.0.4.2 63 stable canonical -


Now there are so many disabled packages there which are no longer used. So I want to remove those packages. Here the command is snap remove gnome-3-26-1604 --revision=62 . Now I have to do it for all the revisions and for all the packages one by one. Is there any command which will remove the disabled or unused snap packages with single line of command?



Thanks in advance...









share|improve this question













share|improve this question




share|improve this question








edited May 16 at 8:46

























asked May 15 at 17:36









Ryko

395313




395313











  • Would it be possible for you to edit your question and instead of an image do copy and paste of the text? It really is discouraged to have images unless absolutely needed. It helps us with helping you. Thanks!
    – Terrance
    May 15 at 17:49







  • 1




    Yeah sure!! I have edited the question...
    – Ryko
    May 16 at 8:47










  • Note that keeping a single previous version is by design: when a snap is updated, the older revision will be removed.
    – muru
    May 16 at 8:55










  • But here gimp has 3 versions (revision-30,38,39). Though revision 38 and 39 has same versions... I will inform you later when any of this apps get further updates...
    – Ryko
    May 17 at 4:41










  • Is there any settings available in snap so that I could disable keeping previous versions of the snap applications... Because some of them requires so much space... like libre-office takes in nearly 2GB of space, and if the previous version is included it becomes 4GB.
    – Ryko
    May 17 at 4:44
















  • Would it be possible for you to edit your question and instead of an image do copy and paste of the text? It really is discouraged to have images unless absolutely needed. It helps us with helping you. Thanks!
    – Terrance
    May 15 at 17:49







  • 1




    Yeah sure!! I have edited the question...
    – Ryko
    May 16 at 8:47










  • Note that keeping a single previous version is by design: when a snap is updated, the older revision will be removed.
    – muru
    May 16 at 8:55










  • But here gimp has 3 versions (revision-30,38,39). Though revision 38 and 39 has same versions... I will inform you later when any of this apps get further updates...
    – Ryko
    May 17 at 4:41










  • Is there any settings available in snap so that I could disable keeping previous versions of the snap applications... Because some of them requires so much space... like libre-office takes in nearly 2GB of space, and if the previous version is included it becomes 4GB.
    – Ryko
    May 17 at 4:44















Would it be possible for you to edit your question and instead of an image do copy and paste of the text? It really is discouraged to have images unless absolutely needed. It helps us with helping you. Thanks!
– Terrance
May 15 at 17:49





Would it be possible for you to edit your question and instead of an image do copy and paste of the text? It really is discouraged to have images unless absolutely needed. It helps us with helping you. Thanks!
– Terrance
May 15 at 17:49





1




1




Yeah sure!! I have edited the question...
– Ryko
May 16 at 8:47




Yeah sure!! I have edited the question...
– Ryko
May 16 at 8:47












Note that keeping a single previous version is by design: when a snap is updated, the older revision will be removed.
– muru
May 16 at 8:55




Note that keeping a single previous version is by design: when a snap is updated, the older revision will be removed.
– muru
May 16 at 8:55












But here gimp has 3 versions (revision-30,38,39). Though revision 38 and 39 has same versions... I will inform you later when any of this apps get further updates...
– Ryko
May 17 at 4:41




But here gimp has 3 versions (revision-30,38,39). Though revision 38 and 39 has same versions... I will inform you later when any of this apps get further updates...
– Ryko
May 17 at 4:41












Is there any settings available in snap so that I could disable keeping previous versions of the snap applications... Because some of them requires so much space... like libre-office takes in nearly 2GB of space, and if the previous version is included it becomes 4GB.
– Ryko
May 17 at 4:44




Is there any settings available in snap so that I could disable keeping previous versions of the snap applications... Because some of them requires so much space... like libre-office takes in nearly 2GB of space, and if the previous version is included it becomes 4GB.
– Ryko
May 17 at 4:44










3 Answers
3






active

oldest

votes

















up vote
2
down vote



accepted










I'll look into adding this sometime soon (as a 20% thing). Meanwhile, you could drop



#!/bin/sh
set -eu

snap list --all | awk '/disabled/print $1, $3' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done


into a shell script and run that.






share|improve this answer



























    up vote
    3
    down vote













    The capability to purge/remove old/disabled snaps has been discussed previously but not yet implemented. In the meantime unfortunately it's a manual process.






    share|improve this answer




















    • Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
      – muru
      May 25 at 8:23

















    up vote
    1
    down vote













    This is being worked on by a snapd developer now: https://github.com/snapcore/snapd/pull/5207






    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',
      convertImagesToLinks: true,
      noModals: false,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      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%2f1036633%2fhow-to-remove-disabled-unused-snap-packages-with-a-single-line-of-command%23new-answer', 'question_page');

      );

      Post as a guest






























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      I'll look into adding this sometime soon (as a 20% thing). Meanwhile, you could drop



      #!/bin/sh
      set -eu

      snap list --all | awk '/disabled/print $1, $3' |
      while read snapname revision; do
      snap remove "$snapname" --revision="$revision"
      done


      into a shell script and run that.






      share|improve this answer
























        up vote
        2
        down vote



        accepted










        I'll look into adding this sometime soon (as a 20% thing). Meanwhile, you could drop



        #!/bin/sh
        set -eu

        snap list --all | awk '/disabled/print $1, $3' |
        while read snapname revision; do
        snap remove "$snapname" --revision="$revision"
        done


        into a shell script and run that.






        share|improve this answer






















          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          I'll look into adding this sometime soon (as a 20% thing). Meanwhile, you could drop



          #!/bin/sh
          set -eu

          snap list --all | awk '/disabled/print $1, $3' |
          while read snapname revision; do
          snap remove "$snapname" --revision="$revision"
          done


          into a shell script and run that.






          share|improve this answer












          I'll look into adding this sometime soon (as a 20% thing). Meanwhile, you could drop



          #!/bin/sh
          set -eu

          snap list --all | awk '/disabled/print $1, $3' |
          while read snapname revision; do
          snap remove "$snapname" --revision="$revision"
          done


          into a shell script and run that.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered May 25 at 8:28









          Chipaca

          8,4362243




          8,4362243






















              up vote
              3
              down vote













              The capability to purge/remove old/disabled snaps has been discussed previously but not yet implemented. In the meantime unfortunately it's a manual process.






              share|improve this answer




















              • Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
                – muru
                May 25 at 8:23














              up vote
              3
              down vote













              The capability to purge/remove old/disabled snaps has been discussed previously but not yet implemented. In the meantime unfortunately it's a manual process.






              share|improve this answer




















              • Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
                – muru
                May 25 at 8:23












              up vote
              3
              down vote










              up vote
              3
              down vote









              The capability to purge/remove old/disabled snaps has been discussed previously but not yet implemented. In the meantime unfortunately it's a manual process.






              share|improve this answer












              The capability to purge/remove old/disabled snaps has been discussed previously but not yet implemented. In the meantime unfortunately it's a manual process.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered May 25 at 8:18









              popey

              11.7k74388




              11.7k74388











              • Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
                – muru
                May 25 at 8:23
















              • Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
                – muru
                May 25 at 8:23















              Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
              – muru
              May 25 at 8:23




              Is there anyway to get machine-readable information about snaps (JSON or similar) that can be easily parsed to automate this?
              – muru
              May 25 at 8:23










              up vote
              1
              down vote













              This is being worked on by a snapd developer now: https://github.com/snapcore/snapd/pull/5207






              share|improve this answer
























                up vote
                1
                down vote













                This is being worked on by a snapd developer now: https://github.com/snapcore/snapd/pull/5207






                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  This is being worked on by a snapd developer now: https://github.com/snapcore/snapd/pull/5207






                  share|improve this answer












                  This is being worked on by a snapd developer now: https://github.com/snapcore/snapd/pull/5207







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 25 at 14:53









                  Zygmunt Krynicki

                  1,06157




                  1,06157






















                       

                      draft saved


                      draft discarded


























                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function ()
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1036633%2fhow-to-remove-disabled-unused-snap-packages-with-a-single-line-of-command%23new-answer', 'question_page');

                      );

                      Post as a guest













































































                      Popular posts from this blog

                      pylint3 and pip3 broken

                      Missing snmpget and snmpwalk

                      How to enroll fingerprints to Ubuntu 17.10 with VFS491