Is there a command that I can use in order to wipe every file that I, personally, have added to the system?

I don't want it to delete any essential system files – I'm still going to be using the system, but want a fresh start without re-installing the distro.

  • Do you mean your personal files, or also files that you modified as an administrator (e.g. using sudo or su, or via a GUI that does so under the hood)? – Gilles Apr 27 '15 at 23:54
  • Personal files is the higher priority. I'd appreciate a way to do both, though. A completely fresh start. – ALinuxUser Apr 28 '15 at 0:01
  • 1
    It strikes me that if you want a fresh start you would be far better off wiping and reinstalling. – roaima Apr 28 '15 at 9:12
  • 1
    @ALinuxUser there is no need to put 'ANSWERED' in the topic, you have already marked it answered by accepting an answer (with the big checkmark). – derobert Apr 28 '15 at 19:23
  • Ah. Thanks for the tip. I'll just go ahead and remove it, then. – ALinuxUser Apr 28 '15 at 19:23


It’s probably easier to just reinstall. I know you want to avoid that, but it’s the only way to be sure that you don’t delete the wrong files. What follows below will mainly just show you how error-prone and time-intensive it is to try deleting everything otherwise.

Ways to try making it work

The steps below are just an idea. Don’t go deleting everything on your computer just because a random person on the Internet told you to. Look over the steps and see if they make sense first. I may have made some mistakes.

  1. Delete everything in /home except for your empty home directory. Probably nothing in there came with the OS.

  2. Your distro should have a way of listing what files are in a particular package, and what packages you have installed. You could get a list of files in every package using whatever method your package manager provides. Figure out what top-level directories have files in these lists. It will probably be at least /bin, /usr, and /etc. Store that list in ~/pkg_unsort.txt. I can’t give more details without knowing what distribution you’re using.

  3. Sort the list you just made. sort ~/pkg_unsort.txt > ~/pkgfiles.txt.

  4. Figure out what top-level directories have files in the list you just made. It will be at least /usr and /etc.

  5. Then you need a list of all files on your computer that are in those directories. Do a command like this: find /etc /usr | sort > ~/allfiles.txt

  6. Now figure out which files are on your computer that weren’t originally in the packages. comm -12 ~/pkgfiles.txt ~/allfiles.txt > ~/extra.txt. Look over extra.txt to see what’s there.

  7. Delete the files in extra.txt if they look like something you created. As roaima pointed out, some of these files may have been created when packages were being installed on your system. You don’t want to delete those.

This won’t necessarily restore your OS to being a clean install, but it might help. If you changed any files that were installed by a package, then these steps won’t help you. In that case, it would be best to just reinstall the packages affected.

Also, leave everything in /dev, /proc, /run, and probably /boot alone. You may not have much reason to mess with any files outside of /home, /usr, /bin, and /etc.

LVM Snapshots

If you want to have the ability to roll back to previous snapshots of your system, you can use LVM. I have not used LVM, so I can't help with setting it up.

  • 3
    Some files are created as part of a package's post-installation process. Deleting system files just because they are not in a package list is not a good idea; as warned by @yellowantphil it is very important to apply common sense to the list of files generated into extra.txt and not just blindly delete them all – roaima Apr 28 '15 at 9:11
  • Thank you very much for the help. I'll stick to reinstalling. – ALinuxUser Apr 28 '15 at 19:19

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.