Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

i just bourght a VPS, imaged with ubuntu 12.04, and i notice right out of the box it's using 10% ram. I then proceeded to run this:

dpkg-query -Wf '${Package;-40}${Priority}\n' | sort -b -k2,2 -k1,1

And got this huge list. I can see right out of the top I don't need 97% of these, however it would take me the better part of a day to syphon through each package and removing it. Is there any way i can select all the optional/extra packages from this list, and remove them, without causing me loss of access to my VPS via SSH? I have removed all packages marked as required and important from the list, as noone cares.

            db-util                                 extra
            diff                                    extra
            ia32-libs                               extra
            ia32-libs-multiarch                     extra
            iputils-arping                          extra
            klogd                                   extra
            libavc1394-0                            extra
            libcapi20-3                             extra
            libdb4.8                                extra
            libjson0                                extra
            libnfnetlink0                           extra
            librtmp0                                extra
            lsb-release                             extra
            lynx                                    extra
            lynx-cur                                extra
            makedev                                 extra
            mktemp                                  extra
            oss-compat                              extra
            rmail                                   extra
            sendmail                                extra
            sendmail-base                           extra
            sendmail-bin                            extra
            sendmail-cf                             extra
            sendmail-doc                            extra
            sensible-mda                            extra
            sysklogd                                extra
            xinetd                                  extra
            acl                                     optional
            apache2                                 optional
            apache2-doc                             optional
            apache2-mpm-prefork                     optional
            apache2-utils                           optional
            apache2.2-bin                           optional
            apache2.2-common                        optional
            bind9                                   optional
            bind9utils                              optional
            binutils                                optional
            bluez                                   optional
            bluez-alsa                              optional
            busybox-initramfs                       optional
            bzip2                                   optional
            ca-certificates                         optional
            cifs-utils                              optional
            console-common                          optional
            console-data                            optional
            console-tools                           optional
            console-tools-dev                       optional
            cracklib-runtime                        optional
            db5.1-util                              optional
            dbus                                    optional
            dbus-x11                                optional
            dconf-gsettings-backend                 optional
            dconf-service                           optional
            debconf-utils                           optional
            defoma                                  optional
            dmsetup                                 optional
            dselect                                 optional
            ed                                      optional
            esound-common                           optional
            expat                                   optional
            fetchmail                               optional
            finger                                  optional
            fontconfig                              optional
            fontconfig-config                       optional
            gawk                                    optional
            gconf-service                           optional
            gconf-service-backend                   optional
            gconf2                                  optional
            gconf2-common                           optional
            gettext                                 optional
            glib-networking                         optional
            glib-networking-common                  optional
            glib-networking-services                optional
            gsettings-desktop-schemas               optional
            gstreamer0.10-plugins-base              optional
            gstreamer0.10-plugins-good              optional
            gtk2-engines                            optional
            gtk2-engines-murrine                    optional
            gtk2-engines-oxygen                     optional
            gtk2-engines-pixbuf                     optional
            gvfs                                    optional
            gvfs-common                             optional
            gvfs-daemons                            optional
            gvfs-libs                               optional
            gvfs-libs                               optional
            ibus-gtk                                optional
            initramfs-tools                         optional
            initramfs-tools-bin                     optional
            insserv                                 optional
            iputils-tracepath                       optional
            iso-codes                               optional
            klibc-utils                             optional
            ldap-utils                              optional
            libaa1                                  optional
            libaio1                                 optional
            libao-common                            optional
            libao4                                  optional
            libapr1                                 optional
            libaprutil1                             optional
            libaprutil1-dbd-sqlite3                 optional
            libaprutil1-ldap                        optional
            libasn1-8-heimdal                       optional
            libasn1-8-heimdal                       optional
            libasound2                              optional
            libasound2-plugins                      optional
            libasyncns0                             optional
            libatasmart4                            optional
            libatk1.0-0                             optional
            libatk1.0-data                          optional
            libaudio2                               optional
            libaudiofile1                           optional
            libavahi-client3                        optional
            libavahi-client3                        optional
            libavahi-common-data                    optional
            libavahi-common-data                    optional
            libavahi-common3                        optional
            libavahi-common3                        optional
            libbsd0                                 optional
            libcaca0                                optional
            libcairo-gobject2                       optional
            libcairo2                               optional
            libcanberra-gtk-module                  optional
            libcanberra-gtk0                        optional
            libcanberra0                            optional
            libcap-ng0                              optional
            libcdparanoia0                          optional
            libconsole                              optional
            libcrack2                               optional
            libcroco3                               optional
            libcroco3                               optional
            libcups2                                optional
            libcups2                                optional
            libcupsimage2                           optional
            libcurl3                                optional
            libdatrie1                              optional
            libdbus-1-3                             optional
            libdbus-1-3                             optional
            libdbus-glib-1-2                        optional
            libdbus-glib-1-2                        optional
            libdconf0                               optional
            libdevmapper-event1.02.1                optional
            libdrm-intel1                           optional
            libdrm-nouveau1a                        optional
            libdrm-radeon1                          optional
            libdrm2                                 optional
            libdrm2                                 optional
            libdv4                                  optional
            libelf1                                 optional
            libesd0                                 optional
            libexif12                               optional
            libexpat1                               optional
            libexpat1                               optional
            libffi6                                 optional
            libffi6                                 optional
            libfile-copy-recursive-perl             optional
            libflac8                                optional
            libfontconfig1                          optional
            libfontconfig1                          optional
            libfontenc1                             optional
            libfreetype6                            optional
            libfreetype6                            optional
            libgail-common                          optional
            libgail18                               optional
            libgconf-2-4                            optional
            libgconf-2-4                            optional
            libgd2-xpm                              optional
            libgdk-pixbuf2.0-0                      optional
            libgdk-pixbuf2.0-common                 optional
            libgdu0                                 optional
            libgeoip1                               optional
            libgettextpo0                           optional
            libgettextpo0                           optional
            libgl1-mesa-glx                         optional
            libgl1-mesa-glx                         optional
            libglapi-mesa                           optional
            libglapi-mesa                           optional
            libglib2.0-0                            optional
            libglib2.0-0                            optional
            libglu1-mesa                            optional
            libgnome-keyring-common                 optional
            libgnome-keyring0                       optional
            libgnome-keyring0                       optional
            libgomp1                                optional
            libgomp1                                optional
            libgphoto2-2                            optional
            libgphoto2-port0                        optional
            libgssapi3-heimdal                      optional
            libgssapi3-heimdal                      optional
            libgstreamer-plugins-base0.10-0         optional
            libgstreamer0.10-0                      optional
            libgtk2.0-0                             optional
            libgtk2.0-common                        optional
            libhcrypto4-heimdal                     optional
            libhcrypto4-heimdal                     optional
            libheimbase1-heimdal                    optional
            libheimbase1-heimdal                    optional
            libheimntlm0-heimdal                    optional
            libheimntlm0-heimdal                    optional
            libhx509-5-heimdal                      optional
            libhx509-5-heimdal                      optional
            libibus-1.0-0                           optional
            libice6                                 optional
            libice6                                 optional
            libiec61883-0                           optional
            libieee1284-3                           optional
            libisccc80                              optional
            libisccfg82                             optional
            libjack-jackd2-0                        optional
            libjasper1                              optional
            libjpeg-turbo8                          optional
            libjpeg8                                optional
            libklibc                                optional
            libkrb5-26-heimdal                      optional
            libkrb5-26-heimdal                      optional
            liblcms1                                optional
            libltdl7                                optional
            libltdl7                                optional
            liblvm2app2.2                           optional
            libmad0                                 optional
            libmikmod2                              optional
            libmng1                                 optional
            libmpg123-0                             optional
            libnl-3-200                             optional
            libnl-genl-3-200                        optional
            libnspr4                                optional
            libnss3                                 optional
            libodbc1                                optional
            libodbc1                                optional
            libogg0                                 optional
            libopenal-data                          optional
            libopenal1                              optional
            liborc-0.4-0                            optional
            libpango1.0-0                           optional
            libpaper1                               optional
            libparted0debian1                       optional
            libpcap0.8                              optional
            libpciaccess0                           optional
            libperl5.14                             optional
            libpixman-1-0                           optional
            libplymouth2                            optional
            libpng12-0                              optional
            libpng12-0                              optional
            libpolkit-gobject-1-0                   optional
            libproxy1                               optional
            libproxy1                               optional
            libpulse-mainloop-glib0                 optional
            libpulse0                               optional
            libpulsedsp                             optional
            libpython2.7                            optional
            libqt4-dbus                             optional
            libqt4-declarative                      optional
            libqt4-designer                         optional
            libqt4-network                          optional
            libqt4-opengl                           optional
            libqt4-qt3support                       optional
            libqt4-script                           optional
            libqt4-scripttools                      optional
            libqt4-sql                              optional
            libqt4-svg                              optional
            libqt4-test                             optional
            libqt4-xml                              optional
            libqt4-xmlpatterns                      optional
            libqtcore4                              optional
            libqtgui4                               optional
            libqtwebkit4                            optional
            libraw1394-11                           optional
            libroken18-heimdal                      optional
            libroken18-heimdal                      optional
            librsvg2-2                              optional
            librsvg2-common                         optional
            libsamplerate0                          optional
            libsane                                 optional
            libsane-common                          optional
            libsdl-image1.2                         optional
            libsdl-mixer1.2                         optional
            libsdl-net1.2                           optional
            libsdl-ttf2.0-0                         optional
            libsdl1.2debian                         optional
            libsensors4                             optional
            libsgutils2-2                           optional
            libshout3                               optional
            libsigsegv2                             optional
            libsm6                                  optional
            libsm6                                  optional
            libsndfile1                             optional
            libsnmp-base                            optional
            libsnmp15                               optional
            libsoup-gnome2.4-1                      optional
            libsoup2.4-1                            optional
            libspeex1                               optional
            libspeexdsp1                            optional
            libstdc++5                              optional
            libtag1-vanilla                         optional
            libtag1c2a                              optional
            libtalloc2                              optional
            libtdb1                                 optional
            libtdb1                                 optional
            libthai-data                            optional
            libthai0                                optional
            libtheora0                              optional
            libtiff4                                optional
            libunistring0                           optional
            libunistring0                           optional
            libv4l-0                                optional
            libv4lconvert0                          optional
            libvisual-0.4-0                         optional
            libvorbis0a                             optional
            libvorbisenc2                           optional
            libvorbisfile3                          optional
            libwavpack1                             optional
            libwbclient0                            optional
            libwind0-heimdal                        optional
            libwind0-heimdal                        optional
            libwrap0                                optional
            libwrap0                                optional
            libx11-6                                optional
            libx11-6                                optional
            libx11-data                             optional
            libx11-xcb1                             optional
            libx11-xcb1                             optional
            libxau6                                 optional
            libxau6                                 optional
            libxaw7                                 optional
            libxaw7                                 optional
            libxcb-glx0                             optional
            libxcb-glx0                             optional
            libxcb-render0                          optional
            libxcb-shape0                           optional
            libxcb-shm0                             optional
            libxcb1                                 optional
            libxcb1                                 optional
            libxcomposite1                          optional
            libxcomposite1                          optional
            libxcursor1                             optional
            libxdamage1                             optional
            libxdamage1                             optional
            libxdmcp6                               optional
            libxdmcp6                               optional
            libxext6                                optional
            libxext6                                optional
            libxfixes3                              optional
            libxfixes3                              optional
            libxft2                                 optional
            libxft2                                 optional
            libxi6                                  optional
            libxi6                                  optional
            libxinerama1                            optional
            libxinerama1                            optional
            libxmu6                                 optional
            libxmu6                                 optional
            libxmuu1                                optional
            libxp6                                  optional
            libxpm4                                 optional
            libxpm4                                 optional
            libxrandr2                              optional
            libxrender1                             optional
            libxrender1                             optional
            libxslt1.1                              optional
            libxss1                                 optional
            libxt6                                  optional
            libxt6                                  optional
            libxtst6                                optional
            libxtst6                                optional
            libxv1                                  optional
            libxv1                                  optional
            libxxf86dga1                            optional
            libxxf86vm1                             optional
            libxxf86vm1                             optional
            memtester                               optional
            mtools                                  optional
            odbcinst                                optional
            odbcinst1debian2                        optional
            odbcinst1debian2                        optional
            openssh-blacklist                       optional
            openssh-server                          optional
            openssl                                 optional
            openssl-blacklist                       optional
            plymouth                                optional
            procinfo                                optional
            psmisc                                  optional
            psutils                                 optional
            pwgen                                   optional
            python-dbus                             optional
            python-dbus-dev                         optional
            python2.7                               optional
            python2.7-minimal                       optional
            quota                                   optional
            rsync                                   optional
            samba                                   optional
            samba-common                            optional
            samba-common-bin                        optional
            sasl2-bin                               optional
            screen                                  optional
            shared-mime-info                        optional
            sharutils                               optional
            smbfs                                   optional
            snmp                                    optional
            sound-theme-freedesktop                 optional
            ssl-cert                                optional
            sudo                                    optional
            syslinux                                optional
            syslinux-common                         optional
            tcpdump                                 optional
            tcsh                                    optional
            tofrodos                                optional
            ttf-dejavu                              optional
            ttf-dejavu-core                         optional
            ttf-dejavu-extra                        optional
            ttf-freefont                            optional
            udisks                                  optional
            unixodbc                                optional
            unzip                                   optional
            update-inetd                            optional
            uuid-runtime                            optional
            vim                                     optional
            vim-runtime                             optional
            wide-dhcpv6-client                      optional
            x11-common                              optional
            x11-utils                               optional
            xaw3dg                                  optional

            bind9-host                              standard
            bsd-mailx                               standard
            file                                    standard
            ftp                                     standard
            gettext-base                            standard
            less                                    standard
            libbind9-80                             standard
            libcap2                                 standard
            libcap2                                 standard
            libclass-isa-perl                       standard
            libdb5.1                                standard
            libdb5.1                                standard
            libdns81                                standard
            libedit2                                standard
            libgcrypt11                             standard
            libgcrypt11                             standard
            libgnutls26                             standard
            libgnutls26                             standard
            libgpg-error0                           standard
            libgpg-error0                           standard
            libgpm2                                 standard
            libgpm2                                 standard
            libgssapi-krb5-2                        standard
            libgssapi-krb5-2                        standard
            libgssglue1                             standard
            libidn11                                standard
            libidn11                                standard
            libisc83                                standard
            libk5crypto3                            standard
            libk5crypto3                            standard
            libkeyutils1                            standard
            libkeyutils1                            standard
            libkrb5-3                               standard
            libkrb5-3                               standard
            libkrb5support0                         standard
            libkrb5support0                         standard
            libldap-2.4-2                           standard
            libldap-2.4-2                           standard
            liblockfile-bin                         standard
            liblockfile1                            standard
            liblwres80                              standard
            libmagic1                               standard
            libp11-kit0                             standard
            libp11-kit0                             standard
            libsasl2-2                              standard
            libsasl2-2                              standard
            libsqlite3-0                            standard
            libsqlite3-0                            standard
            libswitch-perl                          standard
            libtasn1-3                              standard
            libtasn1-3                              standard
            libtirpc1                               standard
            libxml2                                 standard
            libxml2                                 standard
            lsof                                    standard
            m4                                      standard
            make                                    standard
            mime-support                            standard
            mlocate                                 standard
            multiarch-support                       standard
            ncurses-term                            standard
            openssh-client                          standard
            perl                                    standard
            perl-modules                            standard
            procmail                                standard
            rpcbind                                 standard
            telnet                                  standard
            ucf                                     standard
            whois                                   standard

I can't believe they would install SO much rubbish by default!

Thanks for any suggestions

share|improve this question

3 Answers 3

up vote 1 down vote accepted

Bash Script and some python string magic

Here is the python I used to generate the script: http://paste.ubuntu.com/7966133/

Here is the script you can run: http://paste.ubuntu.com/7966136/

Just make sure you run it in the command line. Let me know if it bugs out, so I can delete this post :P

share|improve this answer
1  
Be prepared to re-deploy your VPS after running this script ;) –  Sergey Aug 6 at 1:51
    
lol; yah; I do not disagree. FYI this is not tested, for obvious reasons. –  Akiva Aug 6 at 1:53
1  
However i can simply remove the packages from this list in order to not COMPLETLY break my system. I'll just keep on there the ones which i know fool well i don't need. This is exactly what i was after. Thanks - I'll give it a test and report the result. –  user3407675 Aug 6 at 2:00
    
@user3407675 Great; glad to hear it. Would you mind accepting this as the answer so the question will be closed? The reason I ask is because it helps keeps the stack exchange clean and organized. Good luck! –  Akiva Aug 6 at 2:05
1  
Confirmed. This solved my problem. Removing the important stuff from the python script, and rerunning it, then cleaned up all the rubbish. Thanks for this. –  user3407675 Aug 6 at 2:14

An installed packages does not consume any RAM - only a running program does. Most of the packages in the list do not install anything which runs as a service consuming RAM - for example diff and bzip2 are console commands which don't run unless you invoke them from the console. Removing them would save you a few kilobytes on disk and exactly zero bytes of RAM.

While I definitely can see packages which are not strictly required on a VPS (ttf-dejavu? libsane?), there are also python, sudo and openssh listed as "optional". I would not recommend you removing these.

Instead, look at the list of running services and deactivate the ones you don't need - like, uninstall Apache and sendmail if you're not going to use them.

share|improve this answer
    
Hm, i should have thought of this lol. I see exactly what you mean, and this has helped me. Thanks –  user3407675 Aug 6 at 1:59
    
Considering the text of the question, I think this should be the accepted answer, because it does exactly what the OP asked for: efficiently spotting and removing what wastes RAM. –  Giulio Muscarello Aug 6 at 11:50

You can reduce RAM usage by stopping unneeded services: Use service --status-all to view the status of all the services and sudo stop <servicename> to stop a service temporarily. You can uninstall the packable permananly buy using sudo apt-get remove <packagename>

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.