Created
December 29, 2022 12:13
-
-
Save pradyumnac/d6ffea4f12ec77cb284c7d370e981beb to your computer and use it in GitHub Desktop.
Get a list of all manually installed packages using apt
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
#!/usr/bin/env bash | |
cat /var/log/apt/history.log 2>/dev/null | | |
egrep '^(Start-Date:|Commandline:)' | | |
grep -v aptdaemon | | |
egrep '^Commandline:'|rg 'apt install'|sed 's/Commandline: apt install//' | |
# Last tested on ubuntu 22.04 (29/12/2022) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
:)
following should be the correct and more appropriate command. ( In your cmdline, 'rg' has no meaning and it may give duplicates as well, plus the log files rotates therefore the archives logs should also be considered. )
zcat /var/log/apt/history.log.*.gz | egrep '^(Start-Date:|Commandline:)' | grep -v aptdaemon | grep 'apt install' | sed 's/Commandline: apt install//' | tr ' ' '\n' | sort -u