Maclean is a straight-forward script that includes many possible actions to reclaim disk space; particularly from caches, logs, and user $HOME.
Defaults to step-by-step prompting - only accept actions you are comfortable with.
Optionally include your own set of paths, clean only desired grouping (âcontainersâ, âdeveloperâ, âbasicâ, etc), or automatically start and affirm all cleanings.
What does it clean exactly?
Click here for an index of all cleaning operations
Operation
Clean
Remove
Paths
Notes
User-defined Junk
~/.adobe , ~/.macromedia
Default targets listed. Edit or add to the array in the script.
Thumbnail cache
~/.cache/thumbnails
Keep anything accessed within last 2 weeks.
$HOME cache
~/.cache
Keep select directories*. Keep anything accessed within last 2 weeks.
I donât think you wrote a single word of this post but I remember desperately needing things like this (ccleaner; otc) in Windows days..
..but Linux? Canât hurt.
I think, from this list, that basic pacman/yay cleanup commands account for 60% of this list.
The other 40%?
Would love to get a Flatpak-scrubbing command and java-specific command and Iâm not sure if the in-house stuff does the coredump data?
Interesting tool all the same. I just ran, tonight, my monthly Idiots Maint Guide stuff. Be interested in how much more useless stuff i could scrub. McCleans an experiment for another night.
Part of the reason I made it on a lark however many moons ago was because the majority of similarly categorized tools (like bleachbit) had some nasty habits.
Not sure what these numbers are meant for/from (total filesize for deletion?.. amount of code in the script?.. number of entries in the index table?), but in any case the only metric in which the pacman/aur-helper section accounts for the majority may be in total space saved - but that being a dependent scenario. IE - depends on the system. In one otherwise very clean but the cache was never tended to - then it would likely account for the majority of space recovered.
Wherever possible the script prefers tools pertinent to the task.
For example - pacman cache is cleaned using paccache .. not some rm ... command.
Flatpak, java, and coredumps are all covered.
Let me know how you find it or if you have some other suggestions.
Just while typing this I realize one possible addition could be an accounting of total space recovered. As of now no such function exists .. one would ostensibly observe the status before and after. If only by looking at the bottom part of dolphin, for example.
I have been using Arch for over five years and rarely needed more than a pacman -Scc to clean the package cache. The cache folders are controlled by the applications that use them and the logs are capped by the journal service (unless there is a problem with something and simply cleaning them does not solve problems that would cause unhealthy growth in cache folders and logs). I guess there may be a use for some of this maintenance, but once you leave Windows behind, you can safely drop the obsessive old habit of cleaning up after the operating system.
But whether someone is a developer using multiple software management sources, or someone has simply forgotten that coredumps can grow quite large, or for some of us that multiples of these things can be true - there can be value, if only in time saved, by simply having to run fewer commands.
Furthermore not everyone exists in a scenario where space is something negligible.
If you like you can think of this more as a collection of aliases for the various cleaning functions that would be pertinent to a given system and/or user $HOME.
( If you have yay then yay cleanings will be triggered .. if you used rust crates then the things for that .. and so on.. )
It may also be noted that a lot of the functions outside of what you may be familiar with deal with errant directories that may be leftovers in $HOME. For which there is no encompassing cleaning available.
The proof could also be in the pudding - I wonder if you would or would not find some superfluous weight, knowing as we do that the âregularâ maintenance has been performed.
My use case is fairly simple. I build Arch based spins and have long ago settled on my preferred software choices.. I can appreciate others have more complex computing needs and may welcome some assistance in cleaning tools. Rock on!
Thereâs always something satisfying about a before and after result, particularly when it has made a difference. As a means of challenge, one could even do their typical cleaning tasks (eg: yay -Yc, paccache, etc), then run your Maclean script to see the difference beyond the typical.
It wasnât meant offenive. It was like smooth ad copy: it made me interested.
My numbers were not clear. If you do a series of cleanup commands like paccache or yay -Rns packagex, for instance, I think (erroneously?) that Endeavour itself does 60% of what McCleanâs does. Or not?
I think projects like this are great for one when they are learning. However I looked at the code and for Me there is a lot of BLOAT. I donât think users should run these types of tools without first knowing how to do it manually. Knowing and understanding how the tools work are what make them affective. People blindly running âCleanerâ tools end up removing things they didnât mean to because they didnât know what they were doing to start with.
Though in the case of maclean the only possible âgotchyaâ is probably the orphans .. if you somehow had orphans you wouldnt want removed.
I dont think anyone who does not know what they are doing should blindly do just about anything - but that would apply to rm or pacman as well as maclean.
Considerations about feasibility and the like I think were mostly answered above.
I am interested in what you would consider bloat?
Each path/function/section is self-contained and does what it is supposed to do with some minor additions in the way of things like text output and prompting.
Taking the example of pacman cache ..
_mc_pacmancache() {
if command -v paccache >/dev/null 2>&1 && [[ $(LANG=C paccache -dk2 | awk 'NR==1 {print $2; exit}') != "no" ]]; then
echo -ne "\nClean installed package cache of all but 2 latest instances (y/N)? "
read -r response
if [[ $response =~ ^(yes|y|Y|Yes)$ ]]; then
paccache -rvk2 ;
echo "Done"
else
echo "Skipped"
fi
fi
}
Line 1 - Check for existence of paccache tool and see if there is any removable cache.
Line 2 - Print the prompt
Line 3 - Blank
Line 4 - Read prompt response
Line 5 - if âyesâ then
Line 6 - Do paccache action
Line 7 - Print âDoneâ
Line 8 - Else
Line 9 - Print âSkippedâ
Line 10-11 - End âifâ statements
What exactly would we consider bloat and remove from this?
I guess there is a blank line..
Iâll look later when I get a chance. There were things for cleaning/clearing that I donât personally need as I donât use those programs / or maybe I have different setting usage for some areaâs. I am not calling it bloat as its big and bloaty for the Average person only for my specific use caseâs.
If it only included the things I personally need to have cleaned it wouldnt be a very effective script for public consumption.
Things like SNAP cleaning is not included because I use SNAPs. Same for the pamac bits. etcetera.
I appreciate the spirit in which you came and shared your efforts here @cscs, as well as the numerous other things youâve shared recently. I think thatâs a really good thing.
Sometimes a community can miss the point, and fail to appreciate the effort and goodwill
If I could pick and choose which of these many variables I could clean, it would be ideal. Itâs an impressive amt of categories and I respect the creator looked for errant debris under every rock since I hate clutter.
I am going to try it though this weekend. @cscs Install directions were very clear, thank you. How would I remove it after Iâve used it?
You can, somewhat imprecisely, by selecting one of the categories through the flags;
Extra Options:
-h Print this Help
-j Clean only the junk directories
-d Clean only the developer directories
-c Clean only the container directories
-b Clean only the few basic directories
-a Automatically affirm all Cleanings
Just delete the script.
It creates/installs nothing aside from itself.
(Though this may change in upcoming versions .. I think I will move out the user-defined âJunkâ array [and possibly some other things] into a conf file under ~/.config/maclean)