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.
Delete everything in
/home except for your empty home directory. Probably nothing in there came with the OS.
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
/etc. Store that list in
~/pkg_unsort.txt. I can’t give more details without knowing what distribution you’re using.
Sort the list you just made.
sort ~/pkg_unsort.txt > ~/pkgfiles.txt.
Figure out what top-level directories have files in the list you just made. It will be at least
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
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.
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
/run, and probably
/boot alone. You may not have much reason to mess with any files outside of
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.