User Tools

Site Tools


This shows you the differences between two versions of the page.

Link to this comparison view [2020/04/16 07:23]
borja created [2022/01/07 15:54] (current)
Line 5: Line 5:
 <code bash> <code bash>
 #!/bin/bash #!/bin/bash
 echo "​Removing unused packages..."​ echo "​Removing unused packages..."​
 apt auto-remove -y apt auto-remove -y
- +  
 echo "​Cleaning logs..."​ echo "​Cleaning logs..."​
 # Stop logging service # Stop logging service
Line 16: Line 16:
 logrotate -f /​etc/​logrotate.conf logrotate -f /​etc/​logrotate.conf
 rm /​var/​log/​*.gz /​var/​log/​*.1 rm /​var/​log/​*.gz /​var/​log/​*.1
- +  
 echo "​Cleaning /tmp and /​var/​tmp..."​ echo "​Cleaning /tmp and /​var/​tmp..."​
 rm -rf /tmp/* rm -rf /tmp/*
 rm -rf /var/tmp/* rm -rf /var/tmp/*
- +  
 echo "​Removing SSH keys..."​ echo "​Removing SSH keys..."​
 rm -rf ~student/​.ssh/​* rm -rf ~student/​.ssh/​*
 rm -rf ~root/​.ssh/​* rm -rf ~root/​.ssh/​*
- +  
 echo "​Removing configuration files and histories..."​ echo "​Removing configuration files and histories..."​
 rm -rf ~root/​.bash_history rm -rf ~root/​.bash_history
Line 39: Line 39:
 rm -rf ~student/​.local/​share/​recently-used.xbel rm -rf ~student/​.local/​share/​recently-used.xbel
 rm -rf ~student/​.config/​sublime-text-3 rm -rf ~student/​.config/​sublime-text-3
- +  
 echo "​Removing old snaps..."​ echo "​Removing old snaps..."​
 # From https://​​2019/​04/​how-to-remove-old-snap-versions-to-free.html # From https://​​2019/​04/​how-to-remove-old-snap-versions-to-free.html
Line 47: Line 47:
         snap remove "​$snapname"​ --revision="​$revision"​         snap remove "​$snapname"​ --revision="​$revision"​
     done     done
- +  
 echo "​Clearing caches..."​ echo "​Clearing caches..."​
 apt clean apt clean
Line 55: Line 55:
 rm -rf /​var/​lib/​apt/​lists/​* rm -rf /​var/​lib/​apt/​lists/​*
 rm -rf /​var/​lib/​snapd/​cache/​* rm -rf /​var/​lib/​snapd/​cache/​*
- +  
 echo "​Adding SSH host key for"​ echo "​Adding SSH host key for"​
 ssh-keyscan -H > ~student/​.ssh/​known_hosts ssh-keyscan -H > ~student/​.ssh/​known_hosts
/var/lib/dokuwiki/data/pages/vm/ · Last modified: 2022/01/07 15:54 by borja