Some process keeps creating a directory named ~ in my home folder. How do I find out which process is doing this? I couldn't find anything useful in the syslog.

I can use ls -l to find the time it was created, but what I really want is to find out how/why it's created and stop that process.

Sadly the user/group is just me and so there's no hints there.


1 Answer 1


If you can get the system to create that file you can do

while true; do lsof /home/$USER/~; done;

Not pretty, hackish but it works without installing any tools.

You can also use an audit tool for this called auditctl:

auditctl -w /home/$USER/~

would then do the same. You can install this with

sudo apt install -y auditd audispd-plugins

Do check your environment variables. The cause, for this issue, turned out to be a wrongly set XDG_CONFIG_HOME

  • That audit tool is exactly what I need. I've set a rule and later today when the directory comes back, I'll finally know what's going on there.
    – patrick
    Oct 19, 2019 at 9:43
  • you found it? @patrick
    – Rinzwind
    Oct 21, 2019 at 12:39
  • Yes and no. It's me, somehow. So I'm pretty sure it's one of my aliases or bash functions. I've accepted your answer because it gave me all the information I can expect it to give me.
    – patrick
    Oct 21, 2019 at 15:38
  • I now have the both the application doing this, chromium, and the reason. I had set in my bashrc file XDG_CONFIG_HOME='~/.config' which was wrong. I changed it to XDG_CONFIG_HOME=$HOME/.config, uninstalled chrome, reinstalled it and everything's now fine. So this just confirms that @Rizwind's answer was the correct one because before I could figure out how I messed up, I first needed to know that it was in fact me and not a software bug of some kind. If you find this post because you've got the same problem check your environment variables.
    – patrick
    Oct 24, 2019 at 8:28
  • good one! glad you found out what it was Added it to the answer in case the comments get deleted :)
    – Rinzwind
    Oct 24, 2019 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.