Thank you very much for this. You have no idea how much time this just saved me.
Thank you very much for this. You have no idea how much time this just saved me.
Great time saver
Except one problem for me:
On "dselect" I got "command not found". That was on a fresh Kubuntu Gutsy install.
What worked, however, was to load the file into Synaptic.
That's exactly the thing I've been looking for. Thank you very much!
Short answer:Code:cat toremove | xargs --replace=+ sudo apt-get -y remove +
It removes all packages listed in 'toremove'.
Long answer:Code:man cat man xargs man apt-get
'toremove' is a file with all the packages you wish to remove listed, one package per line. 'cat' lists them all and the pipe '|' pumps the list into 'xargs'. 'xargs' runs 'sudo apt-get -y remove +' where '+' is replaced with the name of a package. 'xargs' runs it once for each package. Cool, eh?
Any idea how to list installed packages from the official ubuntu repository not any other repository, source install or manually downloaded deb package.
Your freedom is worth more than you think. Take advantage of it while you can.
I take Ubuntu
I am not aware of any apt-* or dpkg command that will definitely indicate the repository from which a package came.
I did notice, however, a certain pattern which seems to suggest when a package comes from some source other than an official repo:
The packages from the official repos seem to report17:18:56 cyrano@farmer:~% apt-cache policy acroread
acroread:
Installed: 8.1.2-0medibuntu1
Candidate: 8.1.2-0medibuntu1
Version table:
*** 8.1.2-0medibuntu1 0
100 /var/lib/dpkg/status
17:19:07 cyrano@farmer:~% apt-cache policy gnome-panel
gnome-panel:
Installed: 1:2.20.1-0ubuntu1
Candidate: 1:2.20.1-0ubuntu1
Version table:
*** 1:2.20.1-0ubuntu1 0
500 http://archive.ubuntu.com gutsy-updates/main Packages
100 /var/lib/dpkg/status
1:2.20.0.1-0ubuntu6 0
500 http://archive.ubuntu.com gutsy/main Packages
http://archive.ubuntu.com while all other packages seem to report /var/lib/dpkg/status.
Based on this pattern, I wrote this perl script which lists packages which are installed on the system grouped according to the repo:
Code:#!/usr/bin/perl use strict; use warnings; my @pkg; open(PACKAGES,"COLUMNS=500 dpkg -l |") || die; while (<PACKAGES>) { if (m/^ii/) { my ($pkg)=($_=~m/^ii\s+(\S+)\s+/); push(@pkg,$pkg) } } close(PACKAGES); my %dat; foreach my $pkg (@pkg) { open(APT,"apt-cache policy $pkg |") || die; my $in_version_section=0; while (my $line=<APT>) { if ($line=~m/^\s*Installed: (.*)/) { ($dat{$pkg}->{version})=($line=~m/^\s*Installed: (.*)/); } elsif ((!$in_version_section)&&(defined($dat{$pkg}->{version})) && ($line=~m/^\s+\S{3}\s+\S+/)) { my ($a_version)=($line=~m/^\s+\S{3}\s+(\S+)/); if ($a_version eq $dat{$pkg}->{version}) { $in_version_section=1; next; } } elsif (($in_version_section) && ($line=~m/^\s+\d+\s+\S+/)) { ($dat{$pkg}->{repo})=($line=~m/^\s+\d+\s+(\S+)/); last; } } close(APT); } my %repo; foreach my $pkg (keys %dat) { my $version=$dat{$pkg}->{version}; my $repo=$dat{$pkg}->{repo}; push(@{$repo{$repo}},"$pkg version $version"); } foreach my $repo (keys %repo) { print "$repo:\n"; foreach (@{$repo{$repo}}) { print " $_\n"; } }
I wanted a list of packages with their descriptions, so I used:
dpkg -l | grep '^[D|+i]' >> installed_dpkg_l.txt
Here is a complete list from a fresh minimal Hardy server i386 install:
Code:adduser install apparmor install apparmor-utils install apt install apt-utils install aptitude install at install base-files install base-passwd install bash install bash-completion install belocs-locales-bin install bind9-host install bsdmainutils install bsdutils install busybox-initramfs install bzip2 install command-not-found install command-not-found-data install console-setup install console-terminus install console-tools install coreutils install cpio install cpp install cpp-4.2 install cron install dash install debconf install debconf-i18n install debianutils install dhcp3-client install dhcp3-common install diff install dmidecode install dnsutils install dosfstools install dpkg install e2fslibs install e2fsprogs install ed install eject install ethtool install fdutils install file install findutils install friendly-recovery install ftp install fuse-utils install gcc-4.2-base install gettext-base install gnupg install gpgv install grep install groff-base install grub install gzip install hdparm install hostname install ifupdown install info install initramfs-tools install initscripts install inputattach install installation-report install iproute install iptables install iputils-arping install iputils-ping install iputils-tracepath install klibc-utils install klogd install laptop-detect install less install libacl1 install libatm1 install libattr1 install libbind9-30 install libblkid1 install libbz2-1.0 install libc6 install libc6-i686 install libcap1 install libcomerr2 install libconsole install libcurl3-gnutls install libcwidget3 install libdb4.6 install libdbus-1-3 install libdevmapper1.02.1 install libdns32 install libedit2 install libelfg0 install libexpat1 install libfribidi0 install libfuse2 install libgc1c2 install libgcc1 install libgcrypt11 install libgdbm3 install libgnutls13 install libgpg-error0 install libgpmg1 install libhtml-parser-perl install libhtml-tagset-perl install libhtml-tree-perl install libidn11 install libisc32 install libisccc30 install libisccfg30 install libiw29 install libkeyutils1 install libklibc install libkrb53 install libldap-2.4-2 install liblocale-gettext-perl install liblwres30 install liblzo2-2 install libmagic1 install libncurses5 install libncursesw5 install libnewt0.52 install libntfs-3g23 install libopencdk10 install libpam-modules install libpam-runtime install libpam0g install libparted1.7-1 install libpcap0.8 install libpopt0 install libreadline5 install librpc-xml-perl install libsasl2-2 install libsasl2-modules install libselinux1 install libsepol1 install libsigc++-2.0-0c2a install libslang2 install libsqlite3-0 install libss2 install libssl0.9.8 install libstdc++6 install libsysfs2 install libtasn1-3 install libterm-readkey-perl install libtext-charwidth-perl install libtext-iconv-perl install libtext-wrapi18n-perl install liburi-perl install libusb-0.1-4 install libuuid1 install libvolume-id0 install libwrap0 install libwww-perl install libxml-parser-perl install linux-image-2.6.24-16-server install linux-image-server install linux-server install linux-ubuntu-modules-2.6.24-16-server install locales install login install logrotate install lsb-base install lsb-release install lshw install lsof install ltrace install lzma install makedev install man-db install manpages install mawk install memtest86+ install mii-diag install mime-support install mktemp install mlocate install module-init-tools install mount install mtr-tiny install nano install ncurses-base install ncurses-bin install net-tools install netbase install netcat install netcat-traditional install ntfs-3g install ntpdate install openssh-client install parted install passwd install pciutils install pcmciautils install perl install perl-base install perl-modules install popularity-contest install ppp install pppconfig install pppoeconf install procps install psmisc install python install python-apt install python-central install python-gdbm install python-gnupginterface install python-minimal install python-support install python2.5 install python2.5-minimal install readline-common install reiserfsprogs install rsync install sed install startup-tasks install strace install sudo install sysklogd install system-services install sysv-rc install sysvutils install tar install tasksel install tasksel-data install tcpd install tcpdump install telnet install time install tzdata install ubuntu-keyring install ubuntu-minimal install ubuntu-standard install ucf install udev install ufw install update-inetd install update-manager-core install upstart install upstart-compat-sysv install upstart-logd install usbutils install util-linux install util-linux-locales install uuid-runtime install vim-common install vim-tiny install w3m install wget install whiptail install wireless-tools install wpasupplicant install xkb-data install zlib1g install
Appreciate that this is four weeks after your post, but since no-one else has yet made a suggestion, how about temporarily editing your sources.list file to only the official repositories (or whatever you're interested in) and then running:??Code:aptitude search . | grep ^i
Think that should do it...?
Simon
Bookmarks