Created
April 4, 2015 09:44
-
-
Save sahildave/caf9263de49f2d8d8471 to your computer and use it in GitHub Desktop.
List all installed packages in ubuntu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
TEMPFILE=`tempfile` | |
cat /var/log/installer/initial-status.gz | gzip -d |grep '^Package:' | awk '{ print $2}' > $TEMPFILE | |
aptitude search -F %p '~i!~M' | awk '{ print $1}' | grep -v -F -f $TEMPFILE | |
rm $TEMPFILE | |
# Run the following to get a list of all the packages | |
# chmod +x installedpackages.sh | |
# ./installedpackages.sh > packages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To remove all the packages:
cat packages | xargs sudo apt-get purge -y
Add -s to simulate the run
sudo apt-get autoremove
to get rid of any dependencies that are no longer needed.