KotaGi logo

How to Get Bad Files Out of Your Unix Home Directory


Caution:

This is a hack. And a poorly made one at that. This article serves as a last resort to more clean solutions.


The Solution Before the Problem.

If you can already intuit what to do, here is the bash script. Using Slade as an example program, for whatever you're doing, just change the script to direct to the binary you want. It's a bash script, but if you're on much older hardware or have better practices than me, you could convert this to a dash script.



Elaborations

When software automatically generates files in your home directory and doesn't honor you with any sort of configuration, there are largely only 2 options to place these files somewhere more appropriate such as ~/.config:


  1. Editing the source to point to the directory you'd prefer, which is easier than one might think but can be impossible if using binaries.
  2. The solution we'll apply, which is a wrapper script that tricks the program into thinking ~/.config is actually the home directory.

How To Use The Solution

To use the script provided, just edit it to your needs and either move the script to one of your executible directories (I personally prefer /usr/bin/. B}) or add the bash files location to your $PATH. In setting a $PATH, I reccommend creating a directory like ~/scripts/bash/wrappers/ with the bash file inside and then using export to set that directory as apart of your $PATH like so:




Other Options




Shown here is a snippet from my bashrc file dedicated to home cleaning. xrdb is beyond the scope of this tutorial but everything following "export..." is involved with environment variables. Most of them are clear in what they do and you should research options for your program on a specific level. In a few cases like in the use of the program less and its history, you may want to have no file generated at all.