dpkg -s <package> - allows you to
find the version of that
you have installed. (source)
apt-cache showpkg <package> - will
show a list of Versions of the
package available. For each version,
the source of the package, in the
form of an index file name, will be
given.
If you want to find the source of the package that's currently installed, you'll need the output of dpkg -s <package>. Otherwise, you can simply look at the newest version output by apt-cache showpkg <package>.
From the first command, I can see that Liferea version 1.6.2-1ubuntu6 is installed. From the second command, I can see that that version is listed in /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-i386_Packages.
Without too much effort, I can deduce that the source line contains archive.ubuntu.com, ubuntu, lucid, and main.
And, sure enough, my /etc/apt/sources.list contains the following line.
deb http://archive.ubuntu.com/ubuntu lucid main universe restricted multiverse
Beside apt-cache policy, showpkg and show, now we have a more simple, with easy to remember subcommands: apt[1][2] (don't get confused with classic apt-*):
apt policy <package>
Or the alternative with more info apt show <package>, line starting with "APT-Sources:".
Description: This package provides command line tools for searching and managing as well as querying information about packages as low-level access to all features of the libapt-pkg library. This includes:apt-get, apt-cache, apt-cdrom, apt-config, apt-key.
Warning: apt does not have a stable CLI interface. Use with caution in scripts.
Removing a package removes all packaged data, but leaves usually small (modified) user configuration files behind, in case the remove was an accident. Just issuing an installation request for the accidentally removed package will restore its function as before in that case. On the other hand you can get rid of these leftovers by calling purge even on already removed packages. Note that this does not affect any data or configuration stored in your home directory.
Sadly, this information is not recorded during package installation. You can make a decent guess if the repository is still in the source list and the repository still has the package:
grep -l PKG /var/lib/apt/lists/*
Even synaptic cannot tell if you disable the repository and update.
Use following command. It has better output:
For Ubuntu 16.04 and later there is a shorter way to do that:
Edit:
Check out SuB's answer. Looks a bit simpler!
Original:
Commands Needed:
dpkg -s <package>
- allows you to find the version of that you have installed. (source)apt-cache showpkg <package>
- will show a list of Versions of the package available. For each version, the source of the package, in the form of an index file name, will be given.If you want to find the source of the package that's currently installed, you'll need the output of
dpkg -s <package>
. Otherwise, you can simply look at the newest version output byapt-cache showpkg <package>
.Example:
From the first command, I can see that Liferea version 1.6.2-1ubuntu6 is installed. From the second command, I can see that that version is listed in
/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_lucid_main_binary-i386_Packages
.Without too much effort, I can deduce that the source line contains
archive.ubuntu.com
,ubuntu
,lucid
, andmain
.And, sure enough, my
/etc/apt/sources.list
contains the following line.apt
on Ubuntu 16.04+Beside
apt-cache policy
,showpkg
andshow
, now we have a more simple, with easy to remember subcommands:apt
[1] [2] (don't get confused with classicapt-*
):Or the alternative with more info
apt show <package>
, line starting with "APT-Sources:".Description: This package provides command line tools for searching and managing as well as querying information about packages as low-level access to all features of the libapt-pkg library. This includes:
apt-get
,apt-cache
,apt-cdrom
,apt-config
,apt-key
.Warning:
apt
does not have a stable CLI interface. Use with caution in scripts.Basic commands from
apt --help
Other also easy to remember subcommands:
apt list
– list packages based on package namesapt search
– search in package descriptionsapt show
– show package detailsapt update
– update list of available packagesapt install
– install packagesapt remove
– remove packagesapt purge
– remove packages and configuration files:To remove residual packages:
apt upgrade
– upgrade the system by installing/upgrading packagesapt full-upgrade
– upgrade the system by removing/installing/upgrading packagesapt edit-sources
– edit the source information fileSadly, this information is not recorded during package installation. You can make a decent guess if the repository is still in the source list and the repository still has the package:
Even synaptic cannot tell if you disable the repository and update.
source
Another useful command is "apt-cache policy". It will show something like this:
Ref: https://wiki.debian.org/AptConfiguration