Spring cleaning of your Slackware system

Sometimes you can find yourself in a situation where you are suddenly faced with a message telling you that there’s no more free space on your system. There might be a few things you can do to free some of it.

The first reason for that can be /tmp which doesn’t get cleaned automatically. I create my temporary files in my home directory so I can safely delete the contents of /tmp every time I shut down the system. You don’t have to do it manually, though. The following command should be placed in /etc/rc.d/rc.local_shutdown

/usr/bin/find /tmp -mindepth 1 -maxdepth 1 -print0 | xargs -0r /bin/rm -rf

As this file doesn’t exist on the default installation of Slackware, you need to create it first and give it execution permission:

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

This will delete ALL the files in the /tmp directory every time the system shuts down, so be careful what you put there! Generally, the rc.local_shutdown file might also be useful in other ways. If you need to perform any other tasks on shutdown, you can put them in the file. Remember to test your commands well before you include them in the shutdown file.

The /tmp directory can also be mounted on a separate partition,  which makes it easy to limit the size of the temporary files directory.

If you have been using sbopkg (an excellent Slackbuilds browser) for a long time, it might also have kept a lot of source files.  First you can check (and optionally delete) if there are any obsolete cached sources:

# sbopkg -o
[ Checking for obsolete sources ]
This may take a few moments. Press <ESC> to abort.
100%[====================================================]
It appears there are no obsolete sources in /var/cache/sbopkg.

As most people do not need the sources of packages installed via sbopkg, you may also want to clean  the whole sbopkg cache. You can do it in sbopkg’s utility menu.

It’s also good practice to find directories/files that take up most space. The following command will display 20 largest files/directories  in a specified place:

du -a /home/user/ | sort -n -r | head -n 20

You can go through the list and decide which things you want to delete.

Update: A quicker way may be using ncdu.

Another way of freeing some space is by uninstalling the apps that you no longer need. If you don’t know what you are doing, it is NOT recommended to uninstall anything from the Slackware’s default installation. You might  break some parts of  the system . A safer approach would be  uninstalling programs that you have manually installed either through sbopkg or any other way. You can browse programs installed via sbopkg using one of its menu items.
You can also remove packages using pkgtool. In order for pkgtool to be able to manage your package, it shouldn’t be compiled using the traditional ./configure ; make ; make install method. You can either create your own slackbuild which will compile, package and install your application, or let the excellent src2pkg tool do it for you.

Happy cleaning

Leave a Reply

Your email address will not be published. Required fields are marked *

* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>