Forked from UniIsland/list-manually-installed-packages.sh
Created
June 22, 2020 20:31
-
-
Save paulcalabro/d869753e22b6fefa97ae6a4d4278d99d to your computer and use it in GitHub Desktop.
List all manually installed packages on a debian/ubuntu system
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/bash | |
## List all manually installed packages on a debian/ubuntu system | |
## manually installed means: | |
## 1. not pre-installed with the system | |
## 2. not marked auto-installed by apt (not dependencies of other | |
## packages) | |
## Note: pre-installed packages that got updated still needs to be | |
## filtered out. | |
parse_dpkg_log() { | |
{ | |
for FN in `ls -1 /var/log/dpkg.log*` ; do | |
CMD="cat" | |
[ ${FN##*.} == "gz" ] && CMD="zcat" | |
$CMD $FN | egrep "[0-9] install" | awk '{print $4}' \ | |
| awk -F":" '{print $1}' | |
done | |
} | sort | uniq | |
} | |
## all packages installed with apt-get/aptitude | |
list_installed=$(parse_dpkg_log) | |
## packages that were not marked as auto installed | |
list_manual=$(apt-mark showmanual | sort) | |
## output intersection of 2 lists | |
comm -12 <(echo "$list_installed") <(echo "$list_manual") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment