-
Notifications
You must be signed in to change notification settings - Fork 0
/
cleanup.sh
39 lines (28 loc) · 1.07 KB
/
cleanup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh
# delete all linux headers
dpkg --list | awk '{ print $2 }' | grep linux-headers | xargs apt-get -y purge
# this removes specific linux kernels, such as
# linux-image-3.11.0-15-generic but
# * keeps the current kernel
# * does not touch the virtual packages, e.g.'linux-image-generic', etc.
#
dpkg --list | awk '{ print $2 }' | grep 'linux-image-3.*-generic' | grep -v `uname -r` | xargs apt-get -y purge
# delete linux source
dpkg --list | awk '{ print $2 }' | grep linux-source | xargs apt-get -y purge
# delete development packages
dpkg --list | awk '{ print $2 }' | grep -- '-dev$' | xargs apt-get -y purge
# delete compilers and other development tools
apt-get -y purge cpp gcc g++
# delete X11 libraries
apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6
# delete obsolete networking
apt-get -y purge ppp pppconfig pppoeconf
# delete oddities
apt-get -y purge popularity-contest
apt-get -y autoremove
apt-get -y clean
# free empty space
dd if=/dev/zero of=/EMPTY
rm -f /EMPTY
# run this on your host
# VBoxManage modifyhd --company your-virtual-hd.vmdk