Fluxuan Forum

Fluxuan Linux, small, fast 32 / 64 bit Operating System.

You are not logged in.

#1 27-01-2024 13:24:04

chour
Moderator
From: Extreme northeast of Europe
Registered: 24-05-2023
LinuxSeaMonkey 2.53

Script for clearing the cache

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.
5022760c3f985b4784d94f2018b09157.jpeg

Last edited by chour (04-02-2024 11:25:07)


Citizen of the world linux

Offline

#2 02-04-2024 18:07:54

Fluxuan
Administrator
From: United Kingdom
Registered: 04-03-2023
Website
DebianFirefox 124.0

Re: Script for clearing the cache

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!" 

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB | Fluxuan.org
This page does not track Cookies, they are used only to make this website and your regitrations possible.