Distinction between apt-cache and dpkg -ldpkg-query vs apt-cachedpkg --get-selections shows packages marked “deinstall”BOTH available-old & available missing from dpkg - “dpkg: error: failed to open package info file `/var/lib/dpkg/available' for reading”successful installing packages but dpkg has errorproblem running apt-get and dpkg command in ubuntu14How to do an offline installation of packages in ubuntu 12.04 by exporting this folder /var/cache/apt/*Difference between apt search and apt-cache searchdpkg and 50unattended-upgrades.ucftmp issuedoes apt-get checks cache directory before downloading packagesproblem with apt and dbkg18.04.1 Server keeps creating /var/lib/dpkg/lock and /var/cache/apt/archives/lock. What now?apt-get Not Working (Again)
Is it possible to have an Abelian group under two different binary operations but the binary operations are not distributive?
Is there an elementary proof that there are infinitely many primes that are *not* completely split in an abelian extension?
Make a transparent 448*448 image
Virginia employer terminated employee and wants signing bonus returned
Rejected in 4th interview round citing insufficient years of experience
Do Bugbears' arms literally get longer when it's their turn?
Look through the portal of every day
Offered promotion but I'm leaving. Should I tell?
Placing subfig vertically
Replacing Windows 7 security updates with anti-virus?
What wound would be of little consequence to a biped but terrible for a quadruped?
Peter's Strange Word
Time travel short story where dinosaur doesn't taste like chicken
A three room house but a three headED dog
What to do when during a meeting client people start to fight (even physically) with each others?
Do f-stop and exposure time perfectly cancel?
Extra alignment tab has been changed to cr. } using table, tabular and resizebox
Single word request: Harming the benefactor
How did Alan Turing break the enigma code using the hint given by the lady in the bar?
Why is there a voltage between the mains ground and my radiator?
Moving plot label
Are the terms "stab" and "staccato" synonyms?
They call me Inspector Morse
Does "variables should live in the smallest scope as possible" include the case "variables should not exist if possible"?
Distinction between apt-cache and dpkg -l
dpkg-query vs apt-cachedpkg --get-selections shows packages marked “deinstall”BOTH available-old & available missing from dpkg - “dpkg: error: failed to open package info file `/var/lib/dpkg/available' for reading”successful installing packages but dpkg has errorproblem running apt-get and dpkg command in ubuntu14How to do an offline installation of packages in ubuntu 12.04 by exporting this folder /var/cache/apt/*Difference between apt search and apt-cache searchdpkg and 50unattended-upgrades.ucftmp issuedoes apt-get checks cache directory before downloading packagesproblem with apt and dbkg18.04.1 Server keeps creating /var/lib/dpkg/lock and /var/cache/apt/archives/lock. What now?apt-get Not Working (Again)
I use apt-cache pkgname to retrieve the packages as
me@host:~$ apt-cache pkgnames | wc -l
62803
get 62803 results
but
me@host:~$ dpkg -l | wc -l
2336
What's the reasons which lead such a huge distinction. I presume that dpkg is super than apt.
apt package-management dpkg
add a comment |
I use apt-cache pkgname to retrieve the packages as
me@host:~$ apt-cache pkgnames | wc -l
62803
get 62803 results
but
me@host:~$ dpkg -l | wc -l
2336
What's the reasons which lead such a huge distinction. I presume that dpkg is super than apt.
apt package-management dpkg
2
Possible duplicate of dpkg-query vs apt-cache
– Olorin
17 hours ago
@Olorin I voted to Leave this question Open. They're duplicates alright, but I want the direction of the duplication to be reversed and dpkg-query vs apt-cache to be closed as a duplicate of this question instead.
– karel
15 hours ago
add a comment |
I use apt-cache pkgname to retrieve the packages as
me@host:~$ apt-cache pkgnames | wc -l
62803
get 62803 results
but
me@host:~$ dpkg -l | wc -l
2336
What's the reasons which lead such a huge distinction. I presume that dpkg is super than apt.
apt package-management dpkg
I use apt-cache pkgname to retrieve the packages as
me@host:~$ apt-cache pkgnames | wc -l
62803
get 62803 results
but
me@host:~$ dpkg -l | wc -l
2336
What's the reasons which lead such a huge distinction. I presume that dpkg is super than apt.
apt package-management dpkg
apt package-management dpkg
edited 18 hours ago
Sergiy Kolodyazhnyy
74.1k9155324
74.1k9155324
asked 21 hours ago
AliceAlice
508111
508111
2
Possible duplicate of dpkg-query vs apt-cache
– Olorin
17 hours ago
@Olorin I voted to Leave this question Open. They're duplicates alright, but I want the direction of the duplication to be reversed and dpkg-query vs apt-cache to be closed as a duplicate of this question instead.
– karel
15 hours ago
add a comment |
2
Possible duplicate of dpkg-query vs apt-cache
– Olorin
17 hours ago
@Olorin I voted to Leave this question Open. They're duplicates alright, but I want the direction of the duplication to be reversed and dpkg-query vs apt-cache to be closed as a duplicate of this question instead.
– karel
15 hours ago
2
2
Possible duplicate of dpkg-query vs apt-cache
– Olorin
17 hours ago
Possible duplicate of dpkg-query vs apt-cache
– Olorin
17 hours ago
@Olorin I voted to Leave this question Open. They're duplicates alright, but I want the direction of the duplication to be reversed and dpkg-query vs apt-cache to be closed as a duplicate of this question instead.
– karel
15 hours ago
@Olorin I voted to Leave this question Open. They're duplicates alright, but I want the direction of the duplication to be reversed and dpkg-query vs apt-cache to be closed as a duplicate of this question instead.
– karel
15 hours ago
add a comment |
2 Answers
2
active
oldest
votes
apt is for managing remote repositories, dpkg - for locally installed packages. They're related. apt is front end to dpkg. When you run apt-get install package it gets .deb file, and installs it via dpkg. So numbers differ because there's a lot of packages available, but only fraction is installed locally on your system.
apt-cache can show both installed and non-installed packages, because it queries the apt cache - listing of what is available in remote repositories ( that cache is what you get when you do apt-get update). For instance,
$ apt-cache policy terminator
terminator:
Installed: (none)
Candidate: 1.91-1
$ dpkg -l terminator
dpkg-query: no packages found matching terminator
Note that there is another tool which can query list of installed/removed local packages, and that's dpkg-query. For instance,
$ dpkg-query -l 'libc6'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
$ dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
As per dpkg manual
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
As far as dpkg-query goes, it should be noted that this tool is focused on querying the database of installed packages, and can output information in particular format(-f option plus -W action). For instance,
$ dpkg-query -W -f='PACK:$PackagenARCH:$ArchitecturenSTAT:$Statusn---n' libc6
PACK:libc6
ARCH:amd64
STAT:install ok installed
---
PACK:libc6
ARCH:i386
STAT:install ok installed
---
Interestingly enough, dpkg database maintains listing of packages that are selected for removal or were removed at some point. dpkg-query can also take glob pattern as an argument, and depending on presence of absence of it show only installed/configured packages or all packages.
add a comment |
dpkg -l shows your installed package versions (starting with ii), removed ones (rc), and some others (e.g. installed but not configured, see the manpage).
apt-cache pkgnames shows you all the available package names (but not versions of the same package) in the added repositories.
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1124914%2fdistinction-between-apt-cache-and-dpkg-l%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
apt is for managing remote repositories, dpkg - for locally installed packages. They're related. apt is front end to dpkg. When you run apt-get install package it gets .deb file, and installs it via dpkg. So numbers differ because there's a lot of packages available, but only fraction is installed locally on your system.
apt-cache can show both installed and non-installed packages, because it queries the apt cache - listing of what is available in remote repositories ( that cache is what you get when you do apt-get update). For instance,
$ apt-cache policy terminator
terminator:
Installed: (none)
Candidate: 1.91-1
$ dpkg -l terminator
dpkg-query: no packages found matching terminator
Note that there is another tool which can query list of installed/removed local packages, and that's dpkg-query. For instance,
$ dpkg-query -l 'libc6'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
$ dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
As per dpkg manual
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
As far as dpkg-query goes, it should be noted that this tool is focused on querying the database of installed packages, and can output information in particular format(-f option plus -W action). For instance,
$ dpkg-query -W -f='PACK:$PackagenARCH:$ArchitecturenSTAT:$Statusn---n' libc6
PACK:libc6
ARCH:amd64
STAT:install ok installed
---
PACK:libc6
ARCH:i386
STAT:install ok installed
---
Interestingly enough, dpkg database maintains listing of packages that are selected for removal or were removed at some point. dpkg-query can also take glob pattern as an argument, and depending on presence of absence of it show only installed/configured packages or all packages.
add a comment |
apt is for managing remote repositories, dpkg - for locally installed packages. They're related. apt is front end to dpkg. When you run apt-get install package it gets .deb file, and installs it via dpkg. So numbers differ because there's a lot of packages available, but only fraction is installed locally on your system.
apt-cache can show both installed and non-installed packages, because it queries the apt cache - listing of what is available in remote repositories ( that cache is what you get when you do apt-get update). For instance,
$ apt-cache policy terminator
terminator:
Installed: (none)
Candidate: 1.91-1
$ dpkg -l terminator
dpkg-query: no packages found matching terminator
Note that there is another tool which can query list of installed/removed local packages, and that's dpkg-query. For instance,
$ dpkg-query -l 'libc6'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
$ dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
As per dpkg manual
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
As far as dpkg-query goes, it should be noted that this tool is focused on querying the database of installed packages, and can output information in particular format(-f option plus -W action). For instance,
$ dpkg-query -W -f='PACK:$PackagenARCH:$ArchitecturenSTAT:$Statusn---n' libc6
PACK:libc6
ARCH:amd64
STAT:install ok installed
---
PACK:libc6
ARCH:i386
STAT:install ok installed
---
Interestingly enough, dpkg database maintains listing of packages that are selected for removal or were removed at some point. dpkg-query can also take glob pattern as an argument, and depending on presence of absence of it show only installed/configured packages or all packages.
add a comment |
apt is for managing remote repositories, dpkg - for locally installed packages. They're related. apt is front end to dpkg. When you run apt-get install package it gets .deb file, and installs it via dpkg. So numbers differ because there's a lot of packages available, but only fraction is installed locally on your system.
apt-cache can show both installed and non-installed packages, because it queries the apt cache - listing of what is available in remote repositories ( that cache is what you get when you do apt-get update). For instance,
$ apt-cache policy terminator
terminator:
Installed: (none)
Candidate: 1.91-1
$ dpkg -l terminator
dpkg-query: no packages found matching terminator
Note that there is another tool which can query list of installed/removed local packages, and that's dpkg-query. For instance,
$ dpkg-query -l 'libc6'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
$ dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
As per dpkg manual
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
As far as dpkg-query goes, it should be noted that this tool is focused on querying the database of installed packages, and can output information in particular format(-f option plus -W action). For instance,
$ dpkg-query -W -f='PACK:$PackagenARCH:$ArchitecturenSTAT:$Statusn---n' libc6
PACK:libc6
ARCH:amd64
STAT:install ok installed
---
PACK:libc6
ARCH:i386
STAT:install ok installed
---
Interestingly enough, dpkg database maintains listing of packages that are selected for removal or were removed at some point. dpkg-query can also take glob pattern as an argument, and depending on presence of absence of it show only installed/configured packages or all packages.
apt is for managing remote repositories, dpkg - for locally installed packages. They're related. apt is front end to dpkg. When you run apt-get install package it gets .deb file, and installs it via dpkg. So numbers differ because there's a lot of packages available, but only fraction is installed locally on your system.
apt-cache can show both installed and non-installed packages, because it queries the apt cache - listing of what is available in remote repositories ( that cache is what you get when you do apt-get update). For instance,
$ apt-cache policy terminator
terminator:
Installed: (none)
Candidate: 1.91-1
$ dpkg -l terminator
dpkg-query: no packages found matching terminator
Note that there is another tool which can query list of installed/removed local packages, and that's dpkg-query. For instance,
$ dpkg-query -l 'libc6'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
$ dpkg -l libc6
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-====================-===============-===============-=============================================
ii libc6:amd64 2.27-3 amd64 GNU C Library: Shared libraries
ii libc6:i386 2.27-3 i386 GNU C Library: Shared libraries
As per dpkg manual
dpkg can also be used as a front-end to dpkg-deb(1) and dpkg-query(1). The list of supported actions can be found later on in the ACTIONS section. If any such action is encountered dpkg just runs dpkg-deb or dpkg-query with the parameters given to it, but no specific options are currently passed to them, to use any such option the back-ends need to be called directly.
As far as dpkg-query goes, it should be noted that this tool is focused on querying the database of installed packages, and can output information in particular format(-f option plus -W action). For instance,
$ dpkg-query -W -f='PACK:$PackagenARCH:$ArchitecturenSTAT:$Statusn---n' libc6
PACK:libc6
ARCH:amd64
STAT:install ok installed
---
PACK:libc6
ARCH:i386
STAT:install ok installed
---
Interestingly enough, dpkg database maintains listing of packages that are selected for removal or were removed at some point. dpkg-query can also take glob pattern as an argument, and depending on presence of absence of it show only installed/configured packages or all packages.
edited 12 hours ago
answered 21 hours ago
Sergiy KolodyazhnyySergiy Kolodyazhnyy
74.1k9155324
74.1k9155324
add a comment |
add a comment |
dpkg -l shows your installed package versions (starting with ii), removed ones (rc), and some others (e.g. installed but not configured, see the manpage).
apt-cache pkgnames shows you all the available package names (but not versions of the same package) in the added repositories.
add a comment |
dpkg -l shows your installed package versions (starting with ii), removed ones (rc), and some others (e.g. installed but not configured, see the manpage).
apt-cache pkgnames shows you all the available package names (but not versions of the same package) in the added repositories.
add a comment |
dpkg -l shows your installed package versions (starting with ii), removed ones (rc), and some others (e.g. installed but not configured, see the manpage).
apt-cache pkgnames shows you all the available package names (but not versions of the same package) in the added repositories.
dpkg -l shows your installed package versions (starting with ii), removed ones (rc), and some others (e.g. installed but not configured, see the manpage).
apt-cache pkgnames shows you all the available package names (but not versions of the same package) in the added repositories.
edited 10 hours ago
terdon♦
66.9k13139221
66.9k13139221
answered 15 hours ago
NyosNyos
1713
1713
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1124914%2fdistinction-between-apt-cache-and-dpkg-l%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
Possible duplicate of dpkg-query vs apt-cache
– Olorin
17 hours ago
@Olorin I voted to Leave this question Open. They're duplicates alright, but I want the direction of the duplication to be reversed and dpkg-query vs apt-cache to be closed as a duplicate of this question instead.
– karel
15 hours ago