How to do factory reset like Colab/Kaggle notebooks do?

Hey there. I’m new here and running an A6000 instance for study purpose. I mistakenly coded my program in a wrong way so I would like to start over from where I started. For example, I installed albumentations, gdown, etc but I would like to have a new instance that does not own what I installed. In Colab/Kaggle, factory reset button is all I need to do a such job. For here, I don’t know what to do. Please enlighten me.