purge all packages manually installed via apt-get from the moment you installed the Ubuntu OS [duplicate]

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








up vote
0
down vote

favorite













This question already has an answer here:



  • Generating list of manually installed packages and querying individual packages

    12 answers



Is there a way to purge all packages installed via apt-get from the very moment you installed the Ubuntu OS, up till this very point?



One could call it a a "mega apt-get purge".



The purpose of this operation to clear the system of everything I've installed so far (from apt) on top of the Ubuntu OS itself. This would bring me the closer to a fresh install of a Ubuntu OS, without any added software (of course, the only thing I'll have left is to clear all non-apt software and individual files I've added, but that is of course another issue).



The reason for this operation is because this is done on a VPS machine in which I can't install and uninstall operating systems in the traditional way; I can indeed use the "rebuild" functionality of my hosting provider but I find it a bit annoying to use from personal reasons so I just want to go closest I can to a fresh install without that.



How will you do the desired "mega apt-get purge"? Thanks.










share|improve this question















marked as duplicate by N0rbert, karel, Eric Carvalho, David Foerster, vidarlo Feb 11 at 14:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 3




    a reinstall? it would take me 17 minutes to do so and get the result you want.
    – Rinzwind
    Feb 10 at 15:16










  • @Rinzwind I've edited to explain why this is not really an option for me, in that particular case...
    – user9303970
    Feb 10 at 15:21










  • @user9303970 still not a problem. I have 10+ VPSes for my business and remount my personal partition in all of them ;)
    – Rinzwind
    Feb 10 at 16:15














up vote
0
down vote

favorite













This question already has an answer here:



  • Generating list of manually installed packages and querying individual packages

    12 answers



Is there a way to purge all packages installed via apt-get from the very moment you installed the Ubuntu OS, up till this very point?



One could call it a a "mega apt-get purge".



The purpose of this operation to clear the system of everything I've installed so far (from apt) on top of the Ubuntu OS itself. This would bring me the closer to a fresh install of a Ubuntu OS, without any added software (of course, the only thing I'll have left is to clear all non-apt software and individual files I've added, but that is of course another issue).



The reason for this operation is because this is done on a VPS machine in which I can't install and uninstall operating systems in the traditional way; I can indeed use the "rebuild" functionality of my hosting provider but I find it a bit annoying to use from personal reasons so I just want to go closest I can to a fresh install without that.



How will you do the desired "mega apt-get purge"? Thanks.










share|improve this question















marked as duplicate by N0rbert, karel, Eric Carvalho, David Foerster, vidarlo Feb 11 at 14:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 3




    a reinstall? it would take me 17 minutes to do so and get the result you want.
    – Rinzwind
    Feb 10 at 15:16










  • @Rinzwind I've edited to explain why this is not really an option for me, in that particular case...
    – user9303970
    Feb 10 at 15:21










  • @user9303970 still not a problem. I have 10+ VPSes for my business and remount my personal partition in all of them ;)
    – Rinzwind
    Feb 10 at 16:15












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • Generating list of manually installed packages and querying individual packages

    12 answers



Is there a way to purge all packages installed via apt-get from the very moment you installed the Ubuntu OS, up till this very point?



One could call it a a "mega apt-get purge".



The purpose of this operation to clear the system of everything I've installed so far (from apt) on top of the Ubuntu OS itself. This would bring me the closer to a fresh install of a Ubuntu OS, without any added software (of course, the only thing I'll have left is to clear all non-apt software and individual files I've added, but that is of course another issue).



The reason for this operation is because this is done on a VPS machine in which I can't install and uninstall operating systems in the traditional way; I can indeed use the "rebuild" functionality of my hosting provider but I find it a bit annoying to use from personal reasons so I just want to go closest I can to a fresh install without that.



How will you do the desired "mega apt-get purge"? Thanks.










share|improve this question
















This question already has an answer here:



  • Generating list of manually installed packages and querying individual packages

    12 answers



Is there a way to purge all packages installed via apt-get from the very moment you installed the Ubuntu OS, up till this very point?



One could call it a a "mega apt-get purge".



The purpose of this operation to clear the system of everything I've installed so far (from apt) on top of the Ubuntu OS itself. This would bring me the closer to a fresh install of a Ubuntu OS, without any added software (of course, the only thing I'll have left is to clear all non-apt software and individual files I've added, but that is of course another issue).



The reason for this operation is because this is done on a VPS machine in which I can't install and uninstall operating systems in the traditional way; I can indeed use the "rebuild" functionality of my hosting provider but I find it a bit annoying to use from personal reasons so I just want to go closest I can to a fresh install without that.



How will you do the desired "mega apt-get purge"? Thanks.





This question already has an answer here:



  • Generating list of manually installed packages and querying individual packages

    12 answers







apt package-management






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 10 at 15:21

























asked Feb 10 at 14:45









user9303970

81112




81112




marked as duplicate by N0rbert, karel, Eric Carvalho, David Foerster, vidarlo Feb 11 at 14:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by N0rbert, karel, Eric Carvalho, David Foerster, vidarlo Feb 11 at 14:31


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 3




    a reinstall? it would take me 17 minutes to do so and get the result you want.
    – Rinzwind
    Feb 10 at 15:16










  • @Rinzwind I've edited to explain why this is not really an option for me, in that particular case...
    – user9303970
    Feb 10 at 15:21










  • @user9303970 still not a problem. I have 10+ VPSes for my business and remount my personal partition in all of them ;)
    – Rinzwind
    Feb 10 at 16:15












  • 3




    a reinstall? it would take me 17 minutes to do so and get the result you want.
    – Rinzwind
    Feb 10 at 15:16










  • @Rinzwind I've edited to explain why this is not really an option for me, in that particular case...
    – user9303970
    Feb 10 at 15:21










  • @user9303970 still not a problem. I have 10+ VPSes for my business and remount my personal partition in all of them ;)
    – Rinzwind
    Feb 10 at 16:15







3




3




a reinstall? it would take me 17 minutes to do so and get the result you want.
– Rinzwind
Feb 10 at 15:16




a reinstall? it would take me 17 minutes to do so and get the result you want.
– Rinzwind
Feb 10 at 15:16












@Rinzwind I've edited to explain why this is not really an option for me, in that particular case...
– user9303970
Feb 10 at 15:21




@Rinzwind I've edited to explain why this is not really an option for me, in that particular case...
– user9303970
Feb 10 at 15:21












@user9303970 still not a problem. I have 10+ VPSes for my business and remount my personal partition in all of them ;)
– Rinzwind
Feb 10 at 16:15




@user9303970 still not a problem. I have 10+ VPSes for my business and remount my personal partition in all of them ;)
– Rinzwind
Feb 10 at 16:15










2 Answers
2






active

oldest

votes

















up vote
1
down vote



accepted










You can use apt with some scripting:



apt list --manual-installed | awk -F "/" 'print $1' > ~/list
sudo apt-get purge --simulate `cat ~/list | grep -v Listing`


Please remember - you are trying to perform very dangerous operation.

If unsure please do not remove --simulate
.



On system with 555 manually installed packages apt-get writes the following:




After this operation, 4 769 MB disk space will be freed.

You are about to do something potentially harmful.

To continue type in the phrase 'Yes, do as I say!'

?]

Yes, do as I say!Enter




then it stops.



So it is completely bad idea (I have no cat, sudo commands afterwards).

System boots with kernel panic.

I have snapshot, I'll restore it in 5 seconds.




Conclusion: you should use clever manual method - for example determine which services were installed manually (with apt list --manual-installed) and running (with htop, netstat, systemctl, whatever) and then purge only their packages.






share|improve this answer






















  • Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
    – user9303970
    Feb 10 at 15:54










  • Do not execute the command above if unsure. It may completely break your system.
    – N0rbert
    Feb 10 at 16:08

















up vote
-1
down vote













If you still have all the logfiles from apt in /var/log/apt , you can do: $grep install /var/log/apt/history.log; zgrep install /var/log/apt/history.log.*.gz , this will show all packages that have been installed on the system through apt.



Removing them in one commandline would take some bash scripting.



Hope this helps.






share|improve this answer



























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote



    accepted










    You can use apt with some scripting:



    apt list --manual-installed | awk -F "/" 'print $1' > ~/list
    sudo apt-get purge --simulate `cat ~/list | grep -v Listing`


    Please remember - you are trying to perform very dangerous operation.

    If unsure please do not remove --simulate
    .



    On system with 555 manually installed packages apt-get writes the following:




    After this operation, 4 769 MB disk space will be freed.

    You are about to do something potentially harmful.

    To continue type in the phrase 'Yes, do as I say!'

    ?]

    Yes, do as I say!Enter




    then it stops.



    So it is completely bad idea (I have no cat, sudo commands afterwards).

    System boots with kernel panic.

    I have snapshot, I'll restore it in 5 seconds.




    Conclusion: you should use clever manual method - for example determine which services were installed manually (with apt list --manual-installed) and running (with htop, netstat, systemctl, whatever) and then purge only their packages.






    share|improve this answer






















    • Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
      – user9303970
      Feb 10 at 15:54










    • Do not execute the command above if unsure. It may completely break your system.
      – N0rbert
      Feb 10 at 16:08














    up vote
    1
    down vote



    accepted










    You can use apt with some scripting:



    apt list --manual-installed | awk -F "/" 'print $1' > ~/list
    sudo apt-get purge --simulate `cat ~/list | grep -v Listing`


    Please remember - you are trying to perform very dangerous operation.

    If unsure please do not remove --simulate
    .



    On system with 555 manually installed packages apt-get writes the following:




    After this operation, 4 769 MB disk space will be freed.

    You are about to do something potentially harmful.

    To continue type in the phrase 'Yes, do as I say!'

    ?]

    Yes, do as I say!Enter




    then it stops.



    So it is completely bad idea (I have no cat, sudo commands afterwards).

    System boots with kernel panic.

    I have snapshot, I'll restore it in 5 seconds.




    Conclusion: you should use clever manual method - for example determine which services were installed manually (with apt list --manual-installed) and running (with htop, netstat, systemctl, whatever) and then purge only their packages.






    share|improve this answer






















    • Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
      – user9303970
      Feb 10 at 15:54










    • Do not execute the command above if unsure. It may completely break your system.
      – N0rbert
      Feb 10 at 16:08












    up vote
    1
    down vote



    accepted







    up vote
    1
    down vote



    accepted






    You can use apt with some scripting:



    apt list --manual-installed | awk -F "/" 'print $1' > ~/list
    sudo apt-get purge --simulate `cat ~/list | grep -v Listing`


    Please remember - you are trying to perform very dangerous operation.

    If unsure please do not remove --simulate
    .



    On system with 555 manually installed packages apt-get writes the following:




    After this operation, 4 769 MB disk space will be freed.

    You are about to do something potentially harmful.

    To continue type in the phrase 'Yes, do as I say!'

    ?]

    Yes, do as I say!Enter




    then it stops.



    So it is completely bad idea (I have no cat, sudo commands afterwards).

    System boots with kernel panic.

    I have snapshot, I'll restore it in 5 seconds.




    Conclusion: you should use clever manual method - for example determine which services were installed manually (with apt list --manual-installed) and running (with htop, netstat, systemctl, whatever) and then purge only their packages.






    share|improve this answer














    You can use apt with some scripting:



    apt list --manual-installed | awk -F "/" 'print $1' > ~/list
    sudo apt-get purge --simulate `cat ~/list | grep -v Listing`


    Please remember - you are trying to perform very dangerous operation.

    If unsure please do not remove --simulate
    .



    On system with 555 manually installed packages apt-get writes the following:




    After this operation, 4 769 MB disk space will be freed.

    You are about to do something potentially harmful.

    To continue type in the phrase 'Yes, do as I say!'

    ?]

    Yes, do as I say!Enter




    then it stops.



    So it is completely bad idea (I have no cat, sudo commands afterwards).

    System boots with kernel panic.

    I have snapshot, I'll restore it in 5 seconds.




    Conclusion: you should use clever manual method - for example determine which services were installed manually (with apt list --manual-installed) and running (with htop, netstat, systemctl, whatever) and then purge only their packages.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Feb 10 at 16:36

























    answered Feb 10 at 15:19









    N0rbert

    16.6k33479




    16.6k33479











    • Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
      – user9303970
      Feb 10 at 15:54










    • Do not execute the command above if unsure. It may completely break your system.
      – N0rbert
      Feb 10 at 16:08
















    • Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
      – user9303970
      Feb 10 at 15:54










    • Do not execute the command above if unsure. It may completely break your system.
      – N0rbert
      Feb 10 at 16:08















    Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
    – user9303970
    Feb 10 at 15:54




    Use it to get a list and than loop through that list as it appears in stdout and purge? Or you'd use a better way?
    – user9303970
    Feb 10 at 15:54












    Do not execute the command above if unsure. It may completely break your system.
    – N0rbert
    Feb 10 at 16:08




    Do not execute the command above if unsure. It may completely break your system.
    – N0rbert
    Feb 10 at 16:08












    up vote
    -1
    down vote













    If you still have all the logfiles from apt in /var/log/apt , you can do: $grep install /var/log/apt/history.log; zgrep install /var/log/apt/history.log.*.gz , this will show all packages that have been installed on the system through apt.



    Removing them in one commandline would take some bash scripting.



    Hope this helps.






    share|improve this answer
























      up vote
      -1
      down vote













      If you still have all the logfiles from apt in /var/log/apt , you can do: $grep install /var/log/apt/history.log; zgrep install /var/log/apt/history.log.*.gz , this will show all packages that have been installed on the system through apt.



      Removing them in one commandline would take some bash scripting.



      Hope this helps.






      share|improve this answer






















        up vote
        -1
        down vote










        up vote
        -1
        down vote









        If you still have all the logfiles from apt in /var/log/apt , you can do: $grep install /var/log/apt/history.log; zgrep install /var/log/apt/history.log.*.gz , this will show all packages that have been installed on the system through apt.



        Removing them in one commandline would take some bash scripting.



        Hope this helps.






        share|improve this answer












        If you still have all the logfiles from apt in /var/log/apt , you can do: $grep install /var/log/apt/history.log; zgrep install /var/log/apt/history.log.*.gz , this will show all packages that have been installed on the system through apt.



        Removing them in one commandline would take some bash scripting.



        Hope this helps.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Feb 10 at 15:07









        Bart J.

        245




        245












            Popular posts from this blog

            How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

            Trouble downloading packages list due to a “Hash sum mismatch” error

            How do I move numbers in filenames, in a batch renaming operation?