Skip to main content
Commonmark migration
Source Link

##How do I get a list of packages not installed as dependencies?

How do I get a list of packages not installed as dependencies?

##How do I get a list of packages not installed as dependencies?

How do I get a list of packages not installed as dependencies?

the script does not work without --disable-columns: by default the package names output from aptitude are padded with blanks -> they wouldn't match the lines of package names from the manifest file when calculating the difference
Source Link
aptitude search '~i !~M' -F '%p' --disable-columns | sort -u > currentlyinstalled.txt
wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest \
  | cut -f1 | sort -u > defaultinstalled.txt
comm -23 currentlyinstalled.txt defaultinstalled.txt
$ aptitude search '~i !~M' -F '%p' --disable-columns | sort -u > currentlyinstalled.txt

Similar approaches can be found in the links that Gilles posted as a comment to the question. Some sources claim that this will only work if you used aptitude to install the packages; however, I almost never use aptitude to install packages and found that this still worked. The --disable-columns prevents aptitude from padding lines of package names with blanks that would hinder the comparison below. The | sort -u sorts the file and removes duplicates. This makes the final step much easier.

aptitude search '~i !~M' -F '%p' | sort -u > currentlyinstalled.txt
wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest \
  | cut -f1 | sort -u > defaultinstalled.txt
comm -23 currentlyinstalled.txt defaultinstalled.txt
$ aptitude search '~i !~M' -F '%p' | sort -u > currentlyinstalled.txt

Similar approaches can be found in the links that Gilles posted as a comment to the question. Some sources claim that this will only work if you used aptitude to install the packages; however, I almost never use aptitude to install packages and found that this still worked. The | sort -u sorts the file and removes duplicates. This makes the final step much easier.

aptitude search '~i !~M' -F '%p' --disable-columns | sort -u > currentlyinstalled.txt
wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest \
  | cut -f1 | sort -u > defaultinstalled.txt
comm -23 currentlyinstalled.txt defaultinstalled.txt
$ aptitude search '~i !~M' -F '%p' --disable-columns | sort -u > currentlyinstalled.txt

Similar approaches can be found in the links that Gilles posted as a comment to the question. Some sources claim that this will only work if you used aptitude to install the packages; however, I almost never use aptitude to install packages and found that this still worked. The --disable-columns prevents aptitude from padding lines of package names with blanks that would hinder the comparison below. The | sort -u sorts the file and removes duplicates. This makes the final step much easier.

as 10.10 links are dead, update to 12.04 links and remove '-d" "' parameter
Source Link
aptitude search '~i !~M' -F '%p' | sort -u > currentlyinstalled.txt
wget -qO - http://mirror.pnl.gov/releases/maverickprecise/ubuntu-1012.1004.3-desktop-amd64.manifest \
  | cut -d" " -f1 | sort -u > defaultinstalled.txt
comm -23 currentlyinstalled.txt defaultinstalled.txt

However, it seems that Ubuntu mirrors contain a "manifest" file that contains all of the packages in the default install. TheThe manifest for my systemUbuntu 12.04.3 is here:

http://mirror.pnl.gov/releases/maverick/ubuntu-10.10-desktop-amd64.manifesthttp://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest

http://mirror.pnl.gov/releases/maverick/http://mirror.pnl.gov/releases/precise/

wget -qO - http://mirror.pnl.gov/releases/maverickprecise/ubuntu-1012.1004.3-desktop-amd64.manifest | cut -d" " -f1 | sort -u > defaultinstalled.txt
aptitude search '~i !~M' -F '%p' | sort -u > currentlyinstalled.txt
wget -qO - http://mirror.pnl.gov/releases/maverick/ubuntu-10.10-desktop-amd64.manifest \
  | cut -d" " -f1 | sort -u > defaultinstalled.txt
comm -23 currentlyinstalled.txt defaultinstalled.txt

However, it seems that Ubuntu mirrors contain a "manifest" file that contains all of the packages in the default install. The manifest for my system is here:

http://mirror.pnl.gov/releases/maverick/ubuntu-10.10-desktop-amd64.manifest

http://mirror.pnl.gov/releases/maverick/

wget -qO - http://mirror.pnl.gov/releases/maverick/ubuntu-10.10-desktop-amd64.manifest | cut -d" " -f1 | sort -u > defaultinstalled.txt
aptitude search '~i !~M' -F '%p' | sort -u > currentlyinstalled.txt
wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest \
  | cut -f1 | sort -u > defaultinstalled.txt
comm -23 currentlyinstalled.txt defaultinstalled.txt

However, it seems that Ubuntu mirrors contain a "manifest" file that contains all of the packages in the default install. The manifest for Ubuntu 12.04.3 is here:

http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest

http://mirror.pnl.gov/releases/precise/

wget -qO - http://mirror.pnl.gov/releases/precise/ubuntu-12.04.3-desktop-amd64.manifest | cut -f1 | sort -u > defaultinstalled.txt
Add -F '%p' instead of cut to avoid truncating package names at 32 characters. (http://unix.stackexchange.com/a/86087/44804)
Source Link
Loading
Add an 'executive summary' with all the code together at the top.
Source Link
Loading
added 32 characters in body
Source Link
Steven D
  • 47.6k
  • 15
  • 123
  • 117
Loading
Source Link
Steven D
  • 47.6k
  • 15
  • 123
  • 117
Loading