You are not logged in.
Pages: 1
Script for partially clearing the cache in the Home folder - browser cache, thumbnails, trash at /home/*user*/.local/share/Trash.
Instead of *user* enter the username to make the script executable.
rm --interactive=never /home/*user*/.cache/thumbnails/large/*.png
rm --interactive=never /home/*user*/.cache/thumbnails/normal/*.png
rm -R --interactive=never /home/*user*/.cache/mozilla/firefox/*
rm -R --interactive=never /home/*user*/.cache/mozilla/seamonkey/*
rm -R --interactive=never /home/*user*/.local/share/Trash/files/*
rm -R --interactive=never /home/*user*/.local/share/Trash/info/*
I prefer to embed the script in Thunar Special(Adwanced) Actions:
1 Let's assume that our script is named .rm-cach.sh and is located among the hidden files in the Home folder
2 In Adwanced Actions, create a new item with the following data:
--Name - Delete cache
--Command - sh /home/*user*/.rm-cach.sh
--Conditions - folders
--Submenu - do not use
Now in Thunar, in the right-click menu there is an option to delete the cache and the ability to free up 2-3 hundred megabytes.
Last edited by chour (04-02-2024 11:25:07)
Citizen of the world linux
Offline
Let`s make this a bit more practical so :
Paste the code in a file with whatever name you want and
bash name-you-put
after you run it you may delete it and whenever you want to clean just write "clean" followed by enter in terminal OR
In thunar go to -> Top Menu / Configure Custom Actions / click on + to ad new Custom Action give it a name a description and in Command field just write -> clean
add a icon like a brush or something
save it right click in thunar and click on the name you gave
#!/bin/bash
# We create our bin folder if not created before
mkdir -p ~/.local/bin
#let`s write the script in there
cat <<EOF > ~/.local/bin/clean
#!/bin/bash
rm --interactive=never ~/.cache/thumbnails/large/*.png
rm --interactive=never ~/.cache/thumbnails/normal/*.png
rm -R --interactive=never ~/.cache/mozilla/firefox/*
rm -R --interactive=never ~/.cache/mozilla/seamonkey/*
rm -R --interactive=never ~/.local/share/Trash/files/*
rm -R --interactive=never ~/.local/share/Trash/info/*
EOF
# let`s make it executable
chmod +x ~/.local/bin/clean
#now let`s run it
clean
echo "Script installed and executed!"
Just a simple man !
https://fluxuan.org | https://start.fluxuan.org | https://forums.fluxuan.org | https://devuan.club
Offline
Pages: 1