My $HOME (otherwise known as '~') directory has lots of hidden configuration folders.

Is it safe to delete all of them?

To be specific

  • Will the OS break if I do so?
  • Will my ethernet/printer/sound/graphics drivers stop working?
  • I don't care about superficial things like: Gnome themes, Key shortcuts, Font settings, etc

You should be relatively safe:

  • Surely your OS won't break, dot files in home directory are mostly configuration files, if they're not there any app will just use the defaults.
  • Device drivers (as ethernet,video,sound,...) should be configured systemwide, so you should be safe.
  • Those are the things will "break" as all your preferences/customizations will get lost, but you don't care ;)

In fact if you add another user to the system his home directory will be mostly empty, apart from some default files which are put inside by default. But those defaults are distro-specific and surely not mandatory.

So yes, you should be quite safe deleting everything under home.

Just in case, play safe and move them to another directory and check everything is ok before deleting them.

| improve this answer | |
  • 9
    That is a really bad advise. You're telling him that it's relatively safe to just delete your databases, but you don't know what those databases contain. You tell him that it's relatively safe to delete .wine, but you don't know which Windows applications he depends upon or what data is stored there. Dangerous advise. -1 – Jo-Erlend Schinstad Jul 31 '11 at 12:54
  • You should always play safe and move folders first, to see if anything breaks. I move every .folder to backups_old folder (for example) every time I do ubuntu upgrade, cuz I wanna have a "clean" new feeling with my desktop (just a habit I guess), and I don't remember having any problems. And if any application breaks (or you just wanna restore settings for particular app), you just find the .folder with the same name and move it back to home. regards – danizmax Jul 31 '11 at 13:04
  • 5
    @jo-erlend he asked specifically about beaking OS and device drivers, not windows applications. – Mr Shunz Jul 31 '11 at 14:26

It is NOT safe to delete them. I want to give you an idea why so I did a quick check on my home folder and here are a some reasons why for me it would not be safe (And make me cry a river really):

  • They contain configuration files. It is known that some of them can recreate themselves but if you changed or customized an application, the change will be gone.

  • For the .local and .cache folder, you are talking about multiple configuration and downloaded cache packages. This involves having to download several megabytes if not gigabytes of information again or having to reinstall some apps again (if they manage to give an error about not reading the configuration file)

  • For very big apps like WINE which happens to hide itself in .wine in the home folder, killing it, well, that is like formatting your whole windows drive. You have just removed everything about wine and any windows app you happened to install. In my case we are talking about 6 apps that come to 23GB of information. Imagine if somebody installed 10 games, microsoft office, photoshop and some other apps and then deleted all of that. Heart attack approaching.

  • If you have the XBMC folder in there which is .xbmc. I know several people including me will cry over the fact that they have to download ALL the content again for the movies and video series. That is about 12 hours worth of work assuming the internet connection does not drop.

  • The .mozilla folder is there. Your configuration and addon information will be lost.

  • Do you use several SSH sites. Well not anymore. You need to configure them again. This could be read as a security problem if you do this on a company.

  • Were you pimping you gimp with better addons. Not anymore, the config got deleted.

  • Did yo happen to have a personalized Terminal window (like the bash and profile hidden files). Nope, you did not, since your configuration file got deleted.

  • Not all hidden elements are folder. There are several hidden file that are used very often like the bash and profile files, the history file and logs.

And to top it off, apart from the obvious Reboot you have to do, there is not 100% way to be sure that everything will come back working correctly. Maybe for a just installed system, but for somebody that for example has had those hidden folders and files since 4 Ubuntu versions ago, one problem can become big very quickly.

Now for you question, will drivers stop working. No they will not. they will still work after cleaning up.

Will the OS break. It depends. If a running service has a configuration in there, you might get a problem there. If a RC customized file has a file in there, you will have a problem. For a common user that just installed the system, there will be no problem at all, but give it a year with several programs installed and customized stuff. you might regret having to delete all of that.

| improve this answer | |

The short answer is yes, it can be dangerous and it will have detrimental effect on your use of the system, even if the system itself won't be affected. That is to say, other users will continue as if nothing had happened, even if your user account will be useless.

Some of the dotfiles are created when the user account is first created, meaning that it will not be recreated automatically. Lots and lots of applications depend on them, meaning that those applications will not work properly. Many applications are totally dependent on configurations. If they aren't available and cannot be created, then the application will be useless and may crash or refuse to run.

It would be similar to deleting the registry in Windows, but worse since dotfiles in Ubuntu not only holds configuration, but also holds personal data. Your databases are stored in ~/.local/share/desktop-couch/ for instance. If you are synced with Ubuntu One, then deleting that folder might also delete those databases from all other computers, including the web.

If you had provided more details about why you would want to do this, then it would be easier to give an exact answer. But if for some reason you really do want to do this, then I think this is the way you should do it: (please be sure you want to)

Only perform these steps if your home directory is not encrypted.

  1. Create a temporary user named "tempuser" for instance.
  2. Add that user to the admin group just in case.
  3. Log out of all desktop sessions
  4. Switch to another console by pressing alt+ctrl+f1
  5. Log in with the temporary user
  6. Rename your old home directory (something like mv /home/bob /home/bob.bak)
  7. Create a new home directory for yourself
  8. Set the right permissions on it.

Now you have a clean system for your user, just as when you logged in for the first time. You can start to copy files from the old home directory into the new one. Don't "cut" or move. That way you'll have the old home directory as backup if something goes wrong. Please pay attention to what you're doing. If you're logged into Ubuntu One, for instance and you replace the files that contain information about synchronized files and folders, then Ubuntu One will notice that those files are no longer available. To it, that means you have deleted them and it will synchronize those deletions across your network, meaning it will delete all those files from all your computers and on the web. So make sure you know what every file is and what every file does. And in any case, do make a backup. There are good chances you will do something you didn't intend to do, or that something you intended to do had side-effects you didn't know about.

In summary:

  • Make sure your reasons are valid
  • Take a backup first (I'm not joking)
  • Pay close attention to what you're doing
  • Write down everything you do so you can learn from your potential mistakes.
| improve this answer | |
  • 2
    Sorry but I never saw any application breaking after deleting/moving .folders... usualy they just reconfigure and restore to defaults. What exactly did break for you? – danizmax Jul 31 '11 at 13:08
  • That is a thing, I myself do sometimes. Nothing is broken. He is trying to know if OS is broken or not, so I think the short answer is not. Yes, of course, he will lost all his settings and all the data he creates with that profile – Anwar May 14 '12 at 17:21

I've just tested it and removed everything in my /home/test directory. I was then able to login through terminal (Ctrl+Alt+F1) and graphically too.

Why would you want to do that is another question. If you want to remove a user account, do it from Users and Groups or similar settings manager.

| improve this answer | |

I checked out (Ubuntu 12.04 only): In a fresh user or superuser account there are only three configuration files:


So, the account should behave like a new one, if all hidden files are deleted except these three.

(Of course, all documents, local programs or local configurations saved in the hidden folders will be lost then. And the deletion should be done after logout from another superuser account. For further details, see the other answers.)

| improve this answer | |
  • Agreed, and I think this is the perfect answer. – Anwar May 14 '12 at 17:22

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.