Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Corrected links that should have been relative instead of absolute.

Table of Contents

Table of Contents

Generating Lists of Currently Installed Packages

There are two methods to generate packages to weed through. The first method outputs all packages, including their file size, to a text file. The other is a direct output directly to the console.

Via list

Code Block
languagebash
dpkg --get-selections | cut -f1 | while read pkg; do dpkg -L $pkg | xargs -I'{}' bash -c 'if [ ! -d "{}" ]; then echo "{}"; fi' | tr'\n' '\000' | du -c --files0-from - | tail -1 | sed "s/total/$pkg/"; done | sort -rn > ~/packages.log.txt

Via output to console

Code Block
languagebash
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n

 

Cleaning up Packages and their Configurations

When removing applications, there are usually configurations leftover. In most cases, you want to remove everything. This can be done by doing a purge on the application when removing. If this has not been done, you can do the following to cleanup:

  1. Check for applications that have configurations left behind:

    Code Block
    languagebash
    dpkg --list | grep '^rc\b'
  2. Now you can to a dpkg -P for each individual package, or if you wish to purge everything in the list, you can run the following command: 

    Code Block
    languagebash
    dpkg --list | grep '^rc\b' | awk '{ print $2 }' | xargs dpkg -P
  3. To finish, you run the following commands to finalize the cleanup, and sync of apt-cache and lists: 

    Code Block
    languagebash
    apt-get autoremove
    apt-get clean