Maclean - A script to automate some (safe) cleaning

Heh, beat me to it.

Pretty close to the PKGBUILD I would have posted too.

Though you should only need the one sha256sums='SKIP' (not the extra b2sums, etc).

I also use git rev-parse --short=7 HEAD for exactly 7 character suffix but yours worked out to that anyways.

You can take it over if you want.

If you don’t specify the exact number, it falls back to the “core.abbrev” config, which itself falls back to ‘auto’ if not specified:
”If unspecified or set to “auto”, an appropriate value is computed based on the approximate number of packed objects in your repository, which hopefully is enough for abbreviated object names to stay unique for some time.”

So it should be fine.

Oh I was not trying to say it needed to be changed.
I really pulled up a quick diff of my local PKGBUILD and noted it was very very close save those few things. Well those and I have an else in the package function that should normally be superfluous anyways;

cd "${pkgname%-git}" || exit 1

It is definitely fine. :slight_smile:
I dont think I have any reason to take it over.

Trustwise, I would welcome it. Not saying that @cyb3rko is not trustworthy, far from it, but having the AUR package from the same person that wrote the script would surely have a nice touch. :hugs:

There are co-maintainers.
Though the Maintainer is what you will see in the index.

A dry-run feature that generates a log of what the script would actually remove would be nice.

I had no idea this was on the AUR I had been recommending the use of this on the discord.

Oh cyber, you are the maintainer of the aur pkgbuild, well :smiling_face_with_sunglasses:

Today:

Summary
Clean $HOME cache of files not accessed for 2 weeks (y/N)? y
Done
Recovered 22MiB

Clean thumbnail cache of files not accessed for 2 weeks (y/N)? 
Skipped

Clean up ALL existing coredumps of crashes (y/N)? y
[sudo] password for root: 
Done
Recovered 4MiB

Clean up ALL Flatpak application data (y/N)? y
Done
Recovered 561B

Clean AUR Helper cache of ALL diff and package build files (y/N)? y
Done
Recovered 57MiB

Clean cache of uninstalled packages and unused repositories (y/N)? y
Done
Recovered 2.94GiB

Clean out pacman sandbox and interrupted download directories (y/N)? y

The following will be deleted:
/var/cache/pacman/pkg/download-sBCAkO
/var/cache/pacman/pkg/download-zYlW8U
/var/cache/pacman/pkg/download-nZ2KJg

Continue with removal (y/N)? y
Done
Recovered 0B

Total Recovered: 3.03GiB

So, thanks again.

I just discovered this fantastic tool and recovered 41.23GB!

sorry for this question but how to use this? in the readme it said to run the script, but how to its not written. like i need to paste code in the terminal and it starts cleaning?

Like it says

Just run the script and answer the prompts

Honestly speaking if you don’t understand “run the script” you should definitely not be pasting code in the terminal and probably should be using an immutable distro that does everything via GUI.

If you aren’t comfortable running a shell script you probably shouldn’t be trying to “clean” your system. You need to understand the basics first.

dude you are talking like you learned from your womb. i asked a question and your are being toxic.

Yes, the commands from the readme should be used in a terminal.

Alternatively, you can install it from the AUR and run it immediately with maclean.

It’s more like

  1. Copying stuff into your terminal is dangerous and you shouldn’t do it. ( For example Don't copy-paste commands from webpages — you can get hacked )
  2. system cleaning is a relatively low-priority thing. ‘most everything that’s cleaned is just sitting there taking up space but not really doing much else. It’s worthwhile to gain the space, but not critical
  3. There are step-by-step directions given on the gitlab page that you don’t even reference with your question - none of which include “pasting into the terminal”

Part of learning is being willing to access and read documentation when provided. If you’re not willing/able to do that then you’re going to continue running into roadbumps on an Arch-based distro - because the OS at its core expects some amount of personal investment and involvement in managing corner cases and updates. Part of that expectation is to be able to understand and follow well-written documentation.

If that’s not where you’re at personally then the biggest benefits of the Arch ecosystem - great technical documentation and a transparent package system - aren’t positives for you (and are even negatives - with transparency comes responsibility). You’re likely to break something that you haven’t developed the skills and aptitude to fix - even if it’s a simple fix.

If you want to be happy using an Arch-derived platform you need to develop the skill of reading and applying documentation to a functional level. That doesn’t mean you need to become a Linux guru overnight, but you do need to get comfortable with “run this script and answer its prompts” documentation (and more) sooner rather than later.

very nice tool that tool got 2.4 gb back

hello how did you use this tool in your pc? can you tell me procedures please?

In fact it is.

If you follow the directions there;

You would 1. Download the script, 2. Mark it executable, and 3. Run the script that is in the same location your cursor is by using ./maclean.

( Note that . is both shorthand for ‘current location’ in the same way ~ is for $HOME. And in shells like bash . is also aliased to source, ie; . bashrc. )

Similarly, as with the majority of utilities, the help flag can be used (or viewed at the page) for how to use including options and explanations. ex;

./maclean -h

As with examples like this the syntax is shown.

If the script is in $PATH, such as when it is installed, then only the name need be used and can be executed from anywhere, ex;

maclean

In case part of what is being missed has to do with it - the script does not require any options. You can just run maclean. The options are well, optional, in order to perform specific functions.

PS.

I had been putting off posting here because I got entangled refactoring large portions of the script when intending to just add docker support. I did that too and I am almost done. Just not quite yet. Update soon though.

Run the command on github link ez

command on github link? what?