Score:-2

so why do people still use dpkg when there is apt?

ps flag

Im sorry Im a newbie in Ubuntu.

While dpkg can only install, remove, or query individual packages, apt offers additional functionality, such as automatically handling dependencies, retrieving and installing packages from remote locations, and upgrading all installed packages to their latest versions. - https://www.geekbits.io/what-is-the-difference-between-apt-and-dpkg/#:~:text=While%20dpkg%20can%20only%20install,packages%20to%20their%20latest%20versions.

so why do people still use dpkg when there is apt?

muru avatar
us flag
Can you show a particular example of people using `dpkg`, then we might tell you why it's used there in preference to `apt`? And what is the screenshot supposed to show? Please don't post screenshots of text. Copy the text here instead.
guiverc avatar
cn flag
`apt` is a *front-end* for the `dpkg` tool.. From the manual (ie. `man apt`) it'll tell you "*apt provides a high-level commandline interface for the package management system*" where as `dpkg` is the actual package manager tool (lower level). Are you actually asking a question though? or wanting this to be a *spam* header which is what it currently looks like to me.
user900476 avatar
ps flag
@muru for example, this https://itsfoss.com/install-chrome-ubuntu/
user900476 avatar
ps flag
besides, why cannot I post a screenshot? it is totally fine on other sites of stackexchange
muru avatar
us flag
That one is easy - for years, `dpkg` was the simplest way to directly install a deb file. See https://askubuntu.com/q/40779/158442. It's only fairly recently (I think maybe 5-6 years or so?) that `apt` gained the capability to install a local deb file: https://askubuntu.com/a/1324153/158442
muru avatar
us flag
@user900476 you can post screenshots of text, but why do you _want_ to post a screenshot of text, when simply copying the text here is easier, and it's easier for everybody to read as well? https://unix.meta.stackexchange.com/q/4086/70524
marcelm avatar
cn flag
_"besides, why cannot I post a screenshot?"_ - Because the text in the screenshot cannot be searched. It cannot be copy/pasted by readers. It cannot be read by screenreaders for the visually impaired. It cannot be rendered in a different font for people who want or need that. It won't change colors with styling (such as a dark theme). _"it is totally fine on other sites of stackexchange"_ - Posting images of just text is not acceptable on any of the SE sites. For more info, see [this Q&A](https://meta.stackoverflow.com/a/285557/4782863).
mook765 avatar
cn flag
Does this answer your question? [What is the difference between dpkg and aptitude/apt-get?](https://askubuntu.com/questions/309113/what-is-the-difference-between-dpkg-and-aptitude-apt-get)
Score:9
vn flag

dpkg is the low-level packaging tool that apt uses to handle packages.

Most "normal" user should only use apt, because it automatically handles dependencies.

Only in very special cases, where you want to install a specific package, and you don't want to automatically resolve dependencies would you use dpkg.

I imagine this would mostly be relevant for troubleshooting and research purposes.

To put it short: If you need dpkg instead of apt, you'll have the insight to know why. If you're not sure, use apt.

And yes, I know some online guides use dpkg - in my opinion, this is a mistake that only causes confusion. The reason is likely (as muru states), that it's only recently that apt got the capability to install local .deb files.

Score:1
in flag

If you are literally just installing/updating/removing packages from your system repositories, there is zero reason to ever use dpkg directly, because APT does everything dpkg does (because it actually uses dpkg internally to do it), plus all the stuff that you generally need to do when managing packages that dpkg doesn’t do.

But, APT doesn’t do everything.

The big thing historically that APT did not do was installing DEB packages directly from the package files instead of fetching them from repos (IOW, up until a few years ago you could not apt-get install /some/package/file.deb, you had to use dpkg, or possibly dselect, for that). That limitation is why a lot of older ‘How to install foo on Debian’ type guides often use dpkg instead of APT, and why things like gdebi exist. These days it’s irrelevant though, because you can just pass a package file to APT and it will do the right thing in 99.9% of cases.

The other big thing that often comes up is figuring out which package a given file belongs to or listing the files installed by a package. APT has no options for this (apt-file can technically do it, but that’s not part of APT, is a pain to parse the output of at times, and it only looks at info from the repositories, not the packages themselves, so it does not always work), but dpkg (or, more correctly dpkg-query) provides options to make such lookups.

There are a number of other things APT just doesn’t cover, but just about all of them are only of interest to developers.

Artur Meinild avatar
vn flag
You're right that `dpkg-query` provides some functionality that `apt` doesn't, and I actually use it.
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.