Created
February 8, 2014 08:20
-
-
Save UniIsland/8878469 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
Shell script works perfect on Raspbian
Distributor ID: Raspbian
Description: Raspbian GNU/Linux 10 (buster)
Release: 10
Codename: buster