Clean up leftovers

I am looking for a program or script that cleans out temp directories and unneeded remnants of past installs and uninstalls.

Thanks.

This old one comes to mind: “Linux is not windows”.
F.e.: if you install a package, then uninstall it, the utmost that will remain is config files. Since the package is no longer there, the config files will not be used.
From what you say, I read that you have the impression that traces of installs/uninstalls are all over the place in well hidden folders and files. That is “so windows”.

Ask yourself: why would you want this?

Hi andy77586,

For /tmp cleaning, you can simply edit /etc/sysconfig/cron and, for example, set CLEAR_TMP_DIRS_AT_BOOTUP to “yes”. You can also specify other temporary files directories with TMP_DIRS_TO_CLEAR.

As a side note, if your temporary files directory is a tmpfs mount point it will be cleared at each power-off. Applications should take care not to let temporary files all over the place anyway.

On 2013-09-15 17:36, kalten wrote:

> For /tmp cleaning, you can simply edit /etc/sysconfig/cron and, for
> example, set CLEAR_TMP_DIRS_AT_BOOTUP to “yes”. You can also specify
> other temporary files directories with TMP_DIRS_TO_CLEAR.

Those settings do not work with systemd. Or some of them.

Look, this is an 11.4 system, with sysv:


cer@minas-tirith:~> l /etc/cron.daily/
total 63
drwxr-xr-x   2 root root   528 Dec 18  2012 ./
drwxr-xr-x 144 root root 11000 Sep 15 21:09 ../
-rwxr-xr-x   1 root root   970 Jul 10  2010 leafnode*
-rwxr-xr-x   1 root root   635 Mar 13  2012 logrotate*
-rwxr-xr-x   1 root root  1414 Dec  6  2011 packagekit-background.cron*
-rwxr--r--   1 root root   948 Feb 23  2011 suse-clean_catman*
-rwxr--r--   1 root root  1693 Feb 23  2011 suse-do_mandb*
-rwxr-xr-x   1 root root   672 Feb 22  2011 suse-texlive*
-rwxr-xr-x   1 root root  1538 Feb 18  2011 suse-updatedb*
-rwxr-xr-x   1 root root   238 Feb 19  2011 suse.cron-sa-update*
-rwxr-xr-x   1 root root  1875 Sep  1  2003 suse.de-backup-rc.config*
-rwxr-xr-x   1 root root  2059 Sep  8  2003 suse.de-backup-rpmdb*
-rwxr-xr-x   1 root root   566 Jul 23  2004 suse.de-check-battery*
-rwxr-xr-x   1 root root  1380 Jan 13  2010 suse.de-clean-tmp*
-rwxr-xr-x   1 root root   371 Sep  1  2003 suse.de-cron-local*
cer@minas-tirith:~>

And now, a 12.3 system with systemd:


Telcontar:~ # l /etc/cron.daily/
total 96
drwxr-xr-x   2 root root  4096 Aug 12 13:21 ./
drwxr-xr-x 199 root root 20480 Sep 14 19:38 ../
-rwxr-xr-x   1 root root   458 Nov 28  2012 leafnode*
-rwxr-xr-x   1 root root   457 Nov 28  2012 leafnode~*
-rwxr-xr-x   1 root root   634 Jul 29 11:08 logrotate*
-rwxr-xr-x   1 root root   590 Mar 27  2011 logrotate~*
-rwxr-xr-x   1 root root   778 Jun 19 10:09 mdadm*
-rwxr-xr-x   1 root root  1297 Aug  3  2011 mlocate.cron*
-rwxr-xr-x   1 root root  1414 Mar 13  2013 packagekit-background.cron*
-rw-r--r--   1 root root   484 Oct 16  2005 smart
-rwxr--r--   1 root root   948 Jan 27  2013 suse-clean_catman*
-rwxr--r--   1 root root  1693 Jan 27  2013 suse-do_mandb*
-rwxr-xr-x   1 root root  1379 Jul 19 15:06 suse-texlive*
-rwxr-xr-x   1 root root   877 Feb 25  2013 suse.cron-sa-update*
-rwxr-xr-x   1 root root  1875 Mar 28 16:25 suse.de-backup-rc.config*
-rwxr-xr-x   1 root root  2059 Mar 28 16:25 suse.de-backup-rpmdb*
-rwxr-xr-x   1 root root   566 Mar 28 16:25 suse.de-check-battery*
-rwxr-xr-x   1 root root   371 Mar 28 16:25 suse.de-cron-local*
-rwx------   1 root root   149 Nov 12  2005 suse.de-faxcron*
-rwxr-xr-x   1 root root   744 Mar  1  2013 suse.de-snapper*
Telcontar:~ #

Do you see something different? About “clean-tmp”? :wink:


Cheers / Saludos,

Carlos E. R.
(from 12.3 x86_64 “Dartmouth” at Telcontar)

Darn, you are right robin_listas. My bad. I just checked openSUSE 12.3 Release Notes:

The good news for you, andy77586, is that your temporary files directory is already automatically cleaned ;).

Was Windows mentioned ?

Was there a comparison to Windows ?

Chill out, life is too short.

Can someone take the penguin off my label.

I think most of us are above the level of an animal.

The Label is part of the default settings for standard users in our vB implementation. And Penguins are a ref to TUX the Linux mascot.

Thanks for the helpful replies.

I edited the chron file and said yes to some of the lines.

I need to make a bash script to clean up files that I download.

It will move zips to a storage directory and delete the rest.

Andy

On Sun, 15 Sep 2013 13:36:03 +0000, andy77586 wrote:

> I am looking for a program or script that cleans out temp directories
> and unneeded remnants of past installs and uninstalls.

tmpwatch is what I use to clear out /tmp - it looks at the access dates
on files and determines that way if the files are still needed.

It’s in the standard repositories.

Jim


Jim Henderson
openSUSE Forums Administrator
Forum Use Terms & Conditions at http://tinyurl.com/openSUSE-T-C