Advertisement
Guest User

Show the manually installed packages (Ubuntu/Debian) (Alias)

a guest
Jan 8th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.54 KB | None | 0 0
  1. # http://ask.debian.net/questions/how-to-get-a-list-of-manually-installed-packages
  2. installed_packages1() {
  3.     aptitude search '~i !~M'
  4. }
  5. # ------------------------------------------------
  6. # Thanks to Nik05 in #Debian @ freenode
  7. installed_packages2() {
  8.     aptitude search '~i !~M !~E !~prequired !~pimportant !~pstandard'
  9. }
  10. # ------------------------------------------------
  11. # http://askubuntu.com/a/492343
  12. installed_packages3() {
  13.     comm -23 <(apt-mark showmanual | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
  14. }
  15. # ------------------------------------------------
  16. installed_packages4() {
  17.     comm -23 <(aptitude search '~i !~M' -F '%p' | sed "s/ *$//" | sort -u) <(gzip -dc /var/log/installer/initial-status.gz | sed -n 's/^Package: //p' | sort -u)
  18. }
  19. # ------------------------------------------------
  20. installed_packages5() {
  21. ## List all manually installed packages on a debian/ubuntu system
  22. ## manually installed means:
  23. ##   1. not pre-installed with the system
  24. ##   2. not marked auto-installed by apt (not dependencies of other
  25. ##      packages)
  26. ## Note: pre-installed packages that got updated still needs to be
  27. ##   filtered out.
  28.  
  29. parse_dpkg_log() {
  30.     {
  31.         for FN in `ls -1 /var/log/dpkg.log*` ; do
  32.             CMD="cat"
  33.             [ ${FN##*.} == "gz" ] && CMD="zcat"
  34.             $CMD $FN | egrep "[0-9] install" | awk '{print $4}' \
  35.                 | awk -F":" '{print $1}'
  36.         done
  37.     } | sort | uniq
  38. }
  39.  
  40. ## all packages installed with apt-get/aptitude
  41. list_installed=$(parse_dpkg_log)
  42. ## packages that were not marked as auto installed
  43. list_manual=$(apt-mark showmanual | sort)
  44.  
  45. ## output intersection of 2 lists
  46. comm -12 <(echo "$list_installed") <(echo "$list_manual")
  47. }
  48. # ------------------------------------------------
  49. # By me... the DeaDSouL ;)
  50. installed_packages_aptitude() {
  51.     while read f; do
  52.         f="${f##* }"
  53.         echo "${f%%:*}"
  54.     done < <(cat /var/log/aptitude | grep -i '\[install\]')
  55. }
  56. # ------------------------------------------------
  57. # By me... the DeaDSouL ;)
  58. installed_packages_apt() {
  59.     while read f; do
  60.         echo "${f##*install }"
  61.     done < <(cat /var/log/apt/history.log | grep 'apt-get *install')
  62. }
  63. # ------------------------------------------------
  64. # By me... the DeaDSouL ;)
  65. # Modified by EriC^^ in #Ubuntu @ freenode .. Thanks :)
  66. installed_packages_apt2() {
  67.     while read f; do
  68.         echo "${f##*install }"
  69.     done < <(cat /var/log/apt/history.log && zcat /var/log/apt/history.log.* | grep -i 'apt-get .*install')
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement