Post

[How To] Clear Cache In Slackware

This time i will share about clear cache in slackware, because if not clearing this cache will bloated in /tmp {default cache Slackware}
First, create this file /etc/rc.d/rc.local_shutdown.append

1
# touch /etc/rc.d/rc.local_shutdown.append

Touch function like create new file (GUI version), but in console/terminal
Second, insert this script that if shutdown will auto removed

1
2
# nano /etc/rc.d/rc.local_shutdown.append  
"/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -exec /bin/rm -rf {} +;"

note: copy paste without quotation
Give access with:

1
# chmod +x /etc/rc.d/rc.local_shutdown.append

OR
Can using this script, create this file:

1
# touch cleanstale.sh

Then

1
# nano cleanstale.sh

Insert this script

1
2
3
4
5
6
7
8
#!/bin/sh  
# Cleanup /tmp however, do not remove sockets for X  
  
# No lost+found with reiserfs  
find /tmp/lost+found -exec /bin/touch {} \\;  
find /tmp -type s -exec /bin/touch {} \\;  
find /tmp -type d -empty -mtime +37 -exec /bin/rmdir {} \\;  
find /tmp -type f -mtime +37 -exec rm -rf {}

Then give access permission, for auto running when system was shutdown.

1
# chmod +x cleanstale.sh

or can using bleachbit, if want installing bleachbit on slackware download in slackbuilds.org
Thanks anyway!

This post is licensed under CC BY 4.0 by the author.