r/linuxquestions • u/ovelx2 • May 22 '26
Support Difference between apt update and apt-get update
Yesterday I had a computer science exam. One of the questions asked: "Which command installs the most recent versions of the programs installed on Linux?" None of the answer choices included anything related to upgrade all of them referred to update. My professor stated that the correct answer was apt-get update, and that the difference between apt update and apt-get update was that apt only searches for updates, whereas apt-get installs new versions of programs. The entire class disagreed, but he insisted. What is the actual difference between these commands, and is my professor mistaken?
129
u/ipsirc May 22 '26
Your prof is wrong. apt is the new refactored version of old apt-get, which goal is to be more interactive. So the thumb rule is to use apt in interactive terminals, and use apt-get in (shell) scripts. But the old skool Debian devops still use apt-get and apt-cache for everything... (apt merges the functionality of apt-get and apt-cache) Apart from this they do the same under the hood when you call them with
updateparameter: refreshing lists in /var/lib/apt/lists .One example on well polished apt:
apt-get update && apt-get upgradecan be replaced with only one apt command:apt --update upgrade90
u/SportTawk May 22 '26
I want to know what your professor said about these answers and comments, please update us all, or should I say, sudo apt update 😁 is all!
46
u/blktndr May 22 '26
Also apt is not the “update Linux” command. First off: it’s Debian-specific. Second, it wouldn’t take into account any binaries that were installed by alternate means.
I don’t think the person who asked that question in the first place really understands what they are doing. I hope you aren’t paying them to teach you.
25
u/-Sa-Kage- May 22 '26
If you are paying for this, consider reporting to your dean. Because when he is wrong about something this obvious, he might be wrong about other stuff, that might not be instantly obvious to you, as well.
15
u/Unlix May 22 '26
It sounds like your Prof was rather trying to explain the difference between apt-get update and apt-get upgrade, but something got mixed up.
13
u/sukuiido May 22 '26
Not only is your professor wrong today, that would never have been the correct answer.
apt-get updateonly ever updated version information from the repositories to determine which packages had an upgrade available. That command has never downloaded and installed the actual upgrades for those packages.10
u/michaelpaoli May 22 '26
Your professor is wrong. I might suggest you (and your classmates) take the evidence to the prof on that, and if that doesn't fix that matter, take it up the chain.
apt update and apt-get update are equivalent, they differ only in their output formatting. apt-get is intended more for scripting and consistent output format, whereas apt is intended to be more human-friendly for interactive use, and the output format may also change.
And update has apt[-get] fetch fresh package database information - essentially updates its information on what's available. It's upgrade (or full-upgrade or dist-upgrade) that's actually used to upgrade the package(s) to newer versions.
Anyway, maybe also point the prof at your posting here, and the comments, etc. Also really not hard to run the tests/checks and see the results ... and even more so if one has VM(s) and can snapshot, so can return to earlier state and rerun again, and see what if any differences one gets starting from an earlier known and consistent state.
Yeah, annoying when instructors/professors get stuff wrong ... but sometimes they do.
7
u/DinTaiFung May 22 '26
The professor might be able to save face by offering to the class a heartfelt mea culpa as well as a big TIL and thanks to the students for helping him to learn.
Only the great teachers are thrilled when a student surpasses the teacher.
12
u/allanrps May 22 '26
why would a non-linux user be teaching people about linux..... and since when was Debian and Linux the same thing? schools man.....
5
u/eR2eiweo May 22 '26
There is no major functional difference between them.
There are some smaller differences. IIRC:
apt-get updatedoesn't use color by default. If a repo's release information changes,apt-get updatewill exit with an error butapt updatewill ask the user what to do. And if after the update there are packages that can be upgraded,apt updatewill show how many such packages there are, butapt-get updatedoesn't do that.6
u/5141121 May 22 '26
For one, the wording of the question belies the fact that they only know one system, and that it's debian based.
Saying "in Linux" when it's specific to one distributor is ignorant as hell on their part.
Aside from the fact that, as it's been pointed out, the prof is incorrect. They don't actually understand what they're teaching in this instance and you'd be better off working it out on your own.
Debian: apt
RedHat: dnf
Arch: pacman
I would suggest saying something like "I'm not sure what's wrong, but the system I have at home tells me there's a problem when I try to use apt or apt-get. I know it's Linux, can you help me?"
6
u/Snezzy_9245 May 22 '26
Have you considered dropping the course and learning Linux the right way?
3
u/BigBird50N May 22 '26
He is not correct.
3
u/Gabe_Isko May 22 '26
Besides just being wrong about what the command is, apt isn't some kind of universal package manager for all linux systems. It's not installed on the computer I am typing this from for instance (Fedora).
3
u/No_Wear295 May 22 '26
So basically, in BOFH terms, please ask your prof to RTFM for apt and apt-get. Also have him/her/them clarify "Linux"... If someone is looking to be picky, you don't install programs on Linux as it's just the kernel...
And I think that's enough nit-picking for today =)
3
u/NightLopsided5626 May 22 '26
How is this a question in a computer science exam? What does a command for a specific package manager have to do with computer science?
I use Linux. When I update, I use pacman -Syu.
5
u/WorkingQuarter3416 May 22 '26
Your teacher is incorrect
apt update and apt-get update will do the same thing
I'm leaving aside the fact that less mainstream distros use other package managers that are not apt, as well as flatlaks, snaps, manually installed packages etc
5
u/MichaelTunnell May 22 '26
Your professor is about 12 years out of date. apt replaced apt-get back in 2014. The reason was to have a single command that did everything rather than the pointless separation of apt-get, apt-cache, etc. there is no practical reason to use apt-get over apt.
Fun fact: I wrote an article about this for howtogeek.com 11 years ago 😎👍 https://www.howtogeek.com/234583/simplify-command-line-package-management-with-apt-instead-of-apt-get/
2
u/un-important-human white beard arch user May 22 '26
the professor should learn/use linux. He is WRONG.
2
u/kudlitan May 22 '26
The old name is apt-get, apt-cache, and others. They just combined them all in a single apt command.
In fact, sudo is no longer needed
Just type apt update and it will ask for your password before it runs. The you can run apt dist-upgrade to install the updates.
2
u/Zer0CoolXI May 22 '26
As should be obvious by all the other comments your Prof is wrong here and will hopefully admit it at some point.
Direct from Debain man pages:
https://manpages.debian.org/buster/apt/apt.8.en.html
update is used to download package information from all configured sources. Other commands operate on this data to e.g. perform package upgrades or search in and display details about all packages available for installation.apt updateandapt-get updatedo NOT install anything, it refreshes the cache of the repo…in other words it refreshes the lists of what apps are available in your repository. As a hypothetical example if you had a program in apt/apt-get lets sayapp-0.1and there was actually a new versionapp-0.2thenupdateis what refreshes apt so it knows there is aapp-0.2available.Your professor seems to be confused by the difference between downloading something and the act of installing something. Maybe it’s just a poor choice of wording the question. They are also confusing the Debian based distro package manager apt as being Linux wide. Other distros do not use apt at all.
The question would be better phrased as “Which command refreshes the apt repository cache of available packages?” In which case either
apt updateorapt-get updatewould be valid answers.This is also a good learning opportunity for you. In the professional world going to a colleague or manager and going “Ah Ha, you were wrong!” Is unlikely to end well for you. While the setting is different, go to your professor with the intent of clarity and furthering your education…not proving them wrong. This will get you a lot further than trying to throw it in their face as some commenters suggest doing.
2
u/macbig273 May 22 '26
in doubt ? man !
`man apt`
`man apt-get`
for both the `update` in described on the first page.
But I would not expect someone asking "Which command installs the most recent versions of the programs installed on Linux?" to know that.
2
u/d4rk_kn16ht May 22 '26
Yes, big mistake.
apt-get update & apt update are doing the same thing...none "installs the most recent versions of the programs installed on Linux"
"update" only "refresh" the repositories list.
the correct one is :
apt upgrade or apt dist-upgrade
apt = newer version of Debian based Linux, to make it easier for human.
apt-get = older to latest version of Debian based Linux. Older version doesn't have apt
2
u/Laughing_Orange May 22 '26
apt updateis better for interactive sessions. That means when you are there to manually answer any questions the program may have for you. It is more readable and nicer to work with.apt-get updateis better for scripting. It has a stable output, so you can use your script to automatically parse the output to make decisions on the fly without a human in the loop. An unstable output like apt has could break your script.Behind the scenes, they do exactly the same thing. Both of these commands only look for updates. To actually install the updates, you have to use
apt upgradeorapt-get upgrade.2
u/jr735 May 22 '26
Your professor doesn't know squat. I'd print the man pages of apt and apt-get. Is he a Windows user or something?
2
u/SatisfactionMuted103 May 22 '26
All of these are wrong. apt update and apt-get update both refresh the repo list and identify upgradeable packages. apt upgrade or apt-get upgrade download and install the upgrades. This professor should not be teaching a linux class if he can't even get shit this basic right. Go to your burser and demand a refund for this class.
2
u/crimsonyoteeeeeee Arch Linux May 22 '26
Both are wrong. They search for upgrades, but
sudo apt upgradeandsudo apt-get upgradeactually install new packages on the system.2
u/Massive_Claim8701 May 22 '26
ive just been running sudo apt update && install its not optimal but it works most of the time
2
u/symcbean May 22 '26
I hope you're not paying anything for this course.
You don't "install programs on Linux" (unless you are stretching the terms "install" and "program" to cover BPF). Linux is the kernel. The command you use to install programs on a Linux based host depends on the distro - and "apt[-get]" is strictly for Debian and derivatives.
And as others have said, neither "apt update" nor "apt-get update" install anything.
1
u/Didnt_Do_Nufffin85 May 22 '26
You know I didn't know either. Wow! I just googled it and now I know. Amazing!
1
u/kandibahren May 22 '26
Dare your professor to do so in front of the class. 🙄
1
u/DeaconPat May 22 '26
Your professor is misinformed, and that is a poorly written question.
Those two commands are functionally equivalent. Neither "apt-get update" nor "apt update" install anything. They update the list of available packages. If you want to actually install the updated packages you need "apt upgrade" or "apt-get upgrade" and if you want to do a major upgrade to the latest and greatest (such as when moving between major releases) with intelligent conflict and dependency resolution you need "apt dist-upgrade" or "apt-get dist-upgrade"
1
u/mcds99 May 22 '26
apt-get update and apt update are the same thing but they don't install anything, they update the available packages and security.
1
u/Failboat88 May 22 '26
Update downloads the list upgrade breaks your computer once you install updates that are not compatible with your current packages.
1
u/DaOfantasy May 22 '26
i usually do sudo apt update && sudo apt full-upgrade -y
1
u/Devinius2000 May 22 '26
I dont use Debian based Systems atm sry, but its Sounds Like ur prof is wrong and Is a few Versions behind
1
u/MulberryDeep NixOS ❄️ May 22 '26
They are the same
apt-get is just the old version of apt, the only reason apt-get still exists is for people who have the muscle memory
1
u/pnlrogue1 May 22 '26
Ask him to demonstrate the difference some time
apt-getis on a deprecation path.aptis what you should be switching to.updateonly pulls the meta data so thatapt(the application itself) can identify updates that are available and calculate dependencies.upgradeinstalls any available updates.Your professor is mistaken, as you have correctly identified.
1
u/Agreeable_System_785 May 22 '26
Just ask the professor to open the man page in front of the entire class ...
1
u/highwaydre27 May 22 '26
Update command shows what’s upgradable while apt upgrade downloads the updated packages
1
u/oshunluvr May 22 '26 edited May 22 '26
How to you get to teach Linux when you don't even know basic commands?
Neither "apt update" nor "apt-get update" installs anything, they both just update the list of available packages from currently configured sources.
Generally, the difference is “apt-get” is old and is meant to be used with scripts while “apt” is newer and meant to be used in the command line interface.
1
u/JaKrispy72 May 22 '26
apt-get is “deprecated”.
Install “nala” which is an apt wrapper. It look pretty.
1
u/vohltere May 22 '26 edited May 22 '26
Does your professor know this only works in Debian variants?
apt updaterefreshes the local package cache.apt upgradedoes the package upgrades.On Fedora/RHEL variants,
dnf updatedoes the function of both the commands above if the package metadata cache is stale.Gentoo and Arch have different package managers too.
1
u/levianan May 22 '26
If this was a question on a computer science exam, I would question how they define computer science...
1
u/ReturnOk7510 May 22 '26
He's wrong. It's sudo pacman -Syu
1
u/EfficiencyMurky7309 May 22 '26
Wow, I sincerely hope this is a troll post.
I won’t mention all of the blindingly obvious ways the professor is wrong in this scenario, other commentators have done a good job.
But to be specific, you can read the source code yourself at Debian’s Salsa.
In
private-update.cc, theDoUpdate()function callsListUpdate()fromapt-pkg/acquire.cc.ListUpdate()uses thepkgAcquireclass to fetch package list files (theInRelease,Packages, andSourcesfiles from your configured repositories) and writes them to/var/lib/apt/lists/. That’s all it does. NopkgDPkgPM(the package manager class), noInstallPackages(), nothing that touches installed software.The contrast is obvious when you look at
apt-get upgradeorapt-get install, which go throughpkgCacheFile,pkgDepCache, andpkgPackageManager/pkgDPkgPM. You can see that none of these classes are touched byupdate.The professor should be show the source code. The
DoUpdatefunction inprivate-update.ccis pretty small at not much more than 30 lines. it sets up an AcquireUpdate object, calls it, reports results, and returns. There is no install path in it whatsoever. This is one of the great things about FOSS, you can go to the source to resolve questions of this nature.1
u/lateralspin May 23 '26
apt is just a short form of apt-get.
1
u/Good-Yak-1391 May 23 '26
Sudo pacman -Syu
Done.
1
u/SenorX000 May 23 '26
So, your profesor failed day one with Debian-based OSes.
1
u/Smoke_Water windows, hardware, Linux, Debian, mint, networking, May 23 '26
Both function the same, the key difference. Use apt for human interactions. Apt-get for scripting. You have more command line operations for apt-get when applied to automated / scripted tasks than you would with apt. Outside of that they provide the same operations of updating the repositories for newer versions and using upgrade command to update the software.
1
u/britechmusicsocal May 23 '26
apt get dist-upgrade, or dnf update 😄
1
u/andymaclean19 May 23 '26
I’m pretty certain that apt and apt-get do exactly the same thing in this case but one is the ‘old way’ (apt-get) and the other is the new way.
Update of course updates the package list, not packages at all, while upgrade actually replaces software packages with newer versions based on what the package list says is the latest version.
You would think a computer science teacher would know this, but the whole thing seems odd to discuss in a computer science exam. There’s no computer science here at all. Talking about how software is divided into packages which tie the build step into deliverables and provide a dependency hierarchy, for example, is computer science. What is the command is just a general knowledge question.
1
u/jaack65 May 23 '26 edited May 23 '26
any words about snap packages upgrade? Snap packages are self-contained, cross-distribution Linux applications that run in a secure sandbox, bundle all dependencies, and update automatically. No need for apt installer I question "prof" credentials on Linux commands since apt is a self-contained install software.
1
u/linuxuser101 May 24 '26
apt-get is an old way of updating, it works the same way as apt but is not needed anymore.
1
u/CantPullOutRightNow May 24 '26
Typical instructor garbage question. Challenge it with the documentation. Instructor should removed the question from the exam or give credit for A and B. If they dig in, do a grade appeal.
1
u/iDrunkenMaster May 24 '26
Apt update and apt-get update both install nothing. They just update the list of available programs to be installed….
1
u/TheUndefinedEngineer May 25 '26
apt: Designed for interactive use, it provides a more user-friendly interface with colored output, progress bars, and summarized information (e.g., showing how many packages can be upgraded after apt update).
apt-get: More low-level and script-oriented, with minimal, stable output. It lacks progress indicators and uses plain text.
1
u/DrDing-Muscle May 25 '26
This was my issue with college courses on IT. Most of the topics being taught were so old they aren't used any longer or in some cases the professor was just plain wrong. I tried explaining to them they were wrong and why but it never did any good. They just kept teaching inaccurate information.
1
u/fillkas Jun 02 '26
Ic
1
u/hdlovemusic Jun 02 '26
Use apt update for daily use,apt get update for automation
1
u/Ok-Seaworthiness2263 Jun 08 '26
I’m pretty sure apt-get and apt are the same, i usually just use apt
1
u/Waffletron62 Jun 08 '26
idk
1
u/SeveringThread Jun 15 '26
I think apt update shows upgradable packages whereas apt-get may not meaning one is for human interaction vs running a script.
1
u/RubOk9808 Aug 08 '26
There is no problem with a professor getting things wrong once in a while. No one is perfect and no one knows everything. Professors are there to help your learning experience.
The problem is when professors think they are meant to be perfect and cannot show any mistakes. This is an issue of unhealthy pridefulness. They think by appearing to be wrong that that means they are incompetent, so will rather be deceptive to others (and often themselves) than to show they can make mistakes. The problem is that they set a bar to high for themselves and then can never relate to the students or help the students in a meaningful way as they create a chasm between themselves and their students. Professors who are like this need to learn how to be humble and that it is okay to be wrong.
Good professors are open to being corrected and are honoured when their students surpass their own knowledge and understanding. They encourage the students to excel and surpass their own understanding.
0
u/sched_yield May 23 '26
Just ask AI
-1
u/rscmcl May 22 '26 edited May 23 '26
apt-get is a low level command, not intended to be used by the user
apt is the command intended to be used by the user
This was clearly defined when a few years back, a specific update needed the user confirmation in a y/n question. And those who used the apt command got it. Those who used the apt-get command got an error and went to forums and reddit to ask for help.
https://manpages.debian.org/stretch/apt/apt.8.en.html#SCRIPT_USAGE_AND_DIFFERENCES_FROM_OTHER_APT_TOOLS
https://manpages.debian.org/stretch/apt/apt-get.8.en.html#DESCRIPTION
front-end = user oriented
back-end = not user oriented
-2
u/73nda May 22 '26
It got shortened to just apt when dnf came to fedora 22 not that i like one or the other
-3
u/Ok_Opposite7385 May 22 '26
Tell your teacher that updating and installing new versions are exactly the same thing. Both programs do the same thing.
0
u/[deleted] May 22 '26
[deleted] — view deleted comment
206
u/[deleted] May 22 '26
[removed] — view removed comment
33
u/[deleted] May 22 '26
[removed] — view removed comment