I saw an answer to a similar question, https://askubuntu.com/a/280843/808169, only there is a gap. The answer was almost spot-on for my case, but didn't answer the question of how I could un-instal newly installed packages along with installing removed ones.
To reproduce what happened to my system, all you need to do is run this one-liner (DO NOT RUN IT, unless you do so on a VM if you have ample time and a lot of kindness):
bash <(wget -q -O - https://bitbucket.org/DataspeedInc/dbw_mkz_ros/raw/default/dbw_mkz/scripts/ros_install.bash)
This one-liner is explained here: https://bitbucket.org/DataspeedInc/dbw_mkz_ros/src/81e63fcc335d7b64139d7482017d6a97b405e250/ROS_SETUP.md?fileviewer=file-view-default
Despite warnings, and because I stayed up all night, I accidentally ran it, and I didn't have any backup up to this point. I also don't want to clean install Ubuntu as I have a lot of libraries install in the /usr/... file subtree.
The answer that I linked to indicates that Ubuntu keeps log files, which can be used to back-trace commands if you know enough bash scripting. Can someone kindly help me formulate such script? I would tremendously appreciate this.
By the way, my system still works, but it just doesn't feel right, as if something at the core is not right and I don't feel safe in terms of privacy.
Thank you in advance.