Does Linux need an occasional cleanup?

Discussion in 'all things UNIX' started by Mrkvonic, Mar 23, 2022.

  1. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,090
    I've written a short article discussing the concept of system maintenance in Linux desktops, highlighting the problem of disk space utilization and cleanup when performing package management operations via GUI tools versus the command line. Take a look.

    https://www.dedoimedo.com/computers/linux-disk-cleanup.html


    Cheers,
    Mrk
     
  2. nicolaasjan

    nicolaasjan Registered Member

    Joined:
    Sep 23, 2018
    Posts:
    487
    Location:
    The Netherlands
  3. chrisretusn

    chrisretusn Registered Member

    Joined:
    Jun 16, 2004
    Posts:
    1,567
    Location:
    Philippines
    I occasionally clean out /tmp/ that pretty much sums it up.
     
  4. fblais

    fblais Registered Member

    Joined:
    Jul 31, 2008
    Posts:
    1,300
    Location:
    Québec, Canada
    There's also bleachbit, but it won't replace apt autoremove for that particular task.
    Quoted from their website:
     
  5. wat0114

    wat0114 Registered Member

    Joined:
    Aug 5, 2012
    Posts:
    3,576
    Location:
    Canada
    Running MX-21, under my Home partition is a text file: .xsession-errors

    A few weeks ago I was surprised to see a package download failed because I was nearly out of disk space, so after searching for the culprit, I found the above file had grown to nearly 7 GB and ate up 99% of the drive space. I deleted it with no issues, and currently it sits at about 400 MB.

    BTW, it was ncdu as mentioned in Mrk's article that I ran to find the culprit eating up disk space.
     
  6. nicolaasjan

    nicolaasjan Registered Member

    Joined:
    Sep 23, 2018
    Posts:
    487
    Location:
    The Netherlands
  7. reasonablePrivacy

    reasonablePrivacy Registered Member

    Joined:
    Oct 7, 2017
    Posts:
    1,554
    Location:
    Member state of European Union
    Bleachbit introduces some risks (as other cleaning tools for Windows etc), but at the same time you can just do backups. I use Bleachbit mainly for Firefox profiles be it on Windows or Linux. It works quite well. It is good idea to backup Firefox profiles before doing it.
     
  8. nicolaasjan

    nicolaasjan Registered Member

    Joined:
    Sep 23, 2018
    Posts:
    487
    Location:
    The Netherlands
    I have my Firefox cache in RAM, so it disappears when I shut down the PC (and prevents SSD writes). :)
    Code:
    browser.cache.disk.parent_directory ---> /dev/shm/firefox
    To let Chromium based browser use RAM, add these arguments to the launcher:
    Code:
    --disk-cache-dir=/dev/shm/chromium/ --disk-cache-size=536870912
    (change size in bytes according to your wishes)

    The rest I manage from within Firefox. Cookies managed via "Cookie Quick Manager".

    Avoid running Bleachbit as root. :eek:
     
    Last edited: Mar 26, 2022
  9. reasonablePrivacy

    reasonablePrivacy Registered Member

    Joined:
    Oct 7, 2017
    Posts:
    1,554
    Location:
    Member state of European Union
    I'm afraid I don't have enough RAM on personal laptop to do that. I will stick to what I have currently.
     
  10. nicolaasjan

    nicolaasjan Registered Member

    Joined:
    Sep 23, 2018
    Posts:
    487
    Location:
    The Netherlands
    Fair enough.
    I have 16GB RAM, and /dev/shm gets half of it allocated by design (8GB).
     
  11. Stupendous Man

    Stupendous Man Registered Member

    Joined:
    Aug 1, 2010
    Posts:
    2,385
    Location:
    the Netherlands
    The article reads,
    Is there any good reason why GUI package managers like Discover do not use purge instead of remove? Or why autoremove is not automatically ran every once in a while? Same question for autoclean.
     
    Last edited: Mar 31, 2022
  12. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    10,090
    Not sure, but it would be useful to have that option.
    Mrk
     
  13. fblais

    fblais Registered Member

    Joined:
    Jul 31, 2008
    Posts:
    1,300
    Location:
    Québec, Canada
    A cron script could do that I guess.
    But you'd need to add it by yourself.
    Something that could be added with an option in the distro config to make things easier.
     
  14. reasonablePrivacy

    reasonablePrivacy Registered Member

    Joined:
    Oct 7, 2017
    Posts:
    1,554
    Location:
    Member state of European Union
    For most packages it only frees negligible amount of space, but it will remove config files. If someone put considerable amount of time into creating config files user probably doesn't want to remove them just in case they will need them again.
     
  15. Stupendous Man

    Stupendous Man Registered Member

    Joined:
    Aug 1, 2010
    Posts:
    2,385
    Location:
    the Netherlands
    I suppose, but those who run cron scripts could also easily run autoremove and autoclean. That's another group of users than the "ordinary people using Linux in the classic desktop fashion, i.e. NO command line wizardry," as mentioned in the article.
     
  16. Stupendous Man

    Stupendous Man Registered Member

    Joined:
    Aug 1, 2010
    Posts:
    2,385
    Location:
    the Netherlands
    You're right, that's true, to run purge instead of remove, by default, may not be the best thing to do.
    However, it would be nice if the option to purge instead of remove would be offered in a GUI package manager like Discover. Muon package manager does offer that option.

    But apart from purge, I wonder about autoremove and autoclean, why those are not automatically ran every once in a while. Is there any good reason for that as well, like there is with purge?
     
  17. The Red Moon

    The Red Moon Registered Member

    Joined:
    May 17, 2012
    Posts:
    4,071
    I use bleachbit very occasionally on my puppy linux system but puppy can be run in RAM so it would not be beneficial to use such cleaners.

    I can restore a backed up save folder in seconds if the system gets borked but then again puppies system files are read only and so bleachbit is quite safe in that regard.
     
  18. tuatara

    tuatara Registered Member

    Joined:
    Apr 7, 2004
    Posts:
    777
    In the old days, this would happen automatically when a Unix system had rebooted. The idea was /tmp is only used for temporary things, so you can always clean it.
    Now I often see it used as an archive :D
     
  19. chrisretusn

    chrisretusn Registered Member

    Joined:
    Jun 16, 2004
    Posts:
    1,567
    Location:
    Philippines
    I come from Unix roots. Sun, Solaris and HP-UX.

    I could set /tmp up to run on tmpfs, I know folks who do this. I'm fine with /tmp as it is in my chosen distribution. There is one program I use the puts a database in /tmp, I submitted a request for him to move it elsewhere.
     
  20. Sampei Nihira

    Sampei Nihira Registered Member

    Joined:
    Apr 7, 2013
    Posts:
    2,475
    Location:
    Italy
    I upgraded from Xubuntu 21.10 to 22.04 on my daughter's pc and performed the obsolete packages cleanup (56 packages).

    As an old Linux user I still have now the convictions of Mrkvonic that he wrote in the opening of the article.

    In your opinion how long is it advisable to perform a new cleanup?
    TH.
     
  21. nicolaasjan

    nicolaasjan Registered Member

    Joined:
    Sep 23, 2018
    Posts:
    487
    Location:
    The Netherlands
    That depends on how much space you have left on your root partition.
    I have little space left at the moment, so I always purge the previous kernel, after the new one behaves well (and making a backup with Timeshift just in case).
     
  22. Sampei Nihira

    Sampei Nihira Registered Member

    Joined:
    Apr 7, 2013
    Posts:
    2,475
    Location:
    Italy
    Thank you for your interest.
    I asked this question because this pc,saturday will be moved permanently to my daughter's house (sigh !!).:(

    It is used at 5.5%.
    I have 945 GB free.
     
    Last edited: May 2, 2022
  23. nicolaasjan

    nicolaasjan Registered Member

    Joined:
    Sep 23, 2018
    Posts:
    487
    Location:
    The Netherlands
    Oh. That's a lot.
    I have only 5.4 Gb free on my root partition... :(

    An old kernel occupies around 300MB.

    What you could do, is helping from time to time with something like TeamViewer.
    It has a Linux version as well. :)
     
  24. Sampei Nihira

    Sampei Nihira Registered Member

    Joined:
    Apr 7, 2013
    Posts:
    2,475
    Location:
    Italy
    Th.:thumb:
    The distance from my house, is very small, only 1 Km.
    It's faster if I go in person when my daughter needs.
    :)
    But I guess not.
    I set up the pc in a very user friendly way.
     
  25. Brian K

    Brian K Imaging Specialist

    Joined:
    Jan 28, 2005
    Posts:
    11,475
    Location:
    NSW, Australia
    I have two identical Linux Mint 20.3 on the same computer. (The original Mint was copied) I used BleachBit to clean the APT in one Mint. After two weeks that OS partition had 2 GB more Free Space than the OS where BleachBit wasn't used.
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.