I had a basic question regarding Ubuntu's "apt-get update/dist-upgrade" behavior. I was unsure of which software packages were updated when "apt-get update/dist-upgrade" were run. I read on other SO forums and the Ubuntu site that all the packages listed in /etc/apt/sources.list are updated when the command is run, which makes sense. But, I also read that any package that I installed with "apt-get install" would be updated too.

However, when I look at sources.list, there are only a few Ubuntu repositories listed and none of the many third party software packages I installed are included (like okular, git, or any other package installed manually) in this file.

So does "apt-get update" actually update all these packages? If so, how does it know to update all these other packages considering they are not enumerated in /etc/apt/sources.list?

Finally, if I wanted to check just one of these programs, say git, for updates manually and install them if there were, how would I go about this?


3 Answers 3

 echo $PATH | perl -pe 's/:/\n/g' | xargs ls -1 | sort

Will list all (1,103 for me) installed commands in your path. Note that a single application can have many commands, and some commands are not on your path by default.

apt list --installed

will list installed (556 for me) packages. Note that a single package can have many applications or might only have libraries and no applications.

apt list

Will list all (52,254 for me) installable packages from the default repositories.

cat /etc/apt/sources.list && cat /etc/apt/sources.list.d/*.list

Will list all (16 for me) installed repositories.

curl 'https://launchpad.net/ubuntu/+ppas?name_filter=&start=0' | grep -A 1 "<td><a"

Will list (paged) all (24,538) Personal Package Archives (repositories) most of which likely will not work on the c2 architecture. Note that software can also be obtained elsewhere, but if you install a package from an external source that does not provide a repository then apt can not update the package.


/etc/apt/sources.list lists package sources, i.e. sites from which packages are downloaded. It does not list individual packages.

Ubuntu themselves distribute a lot of software. As long as it's open source, isn't horribly buggy, and is actively maintained, it's eligible for being in Ubuntu (at least in the “universe” repository, which redistributes most Debian packages). (These are not necessary conditions, but they're the most common case.) It may or may not actually be in Ubuntu: another criteria is that there must be a volunteer to work on that package (unless it's part of the small core that Canonical will pay someone to work on). Packages like okular and git are part of Ubuntu (universe and main respectively). So the corresponding line in sources.list is one of the ones with archive.ubuntu.com.

You can get information about Ubuntu packages online on http://packages.ubuntu.com/, or on your machine using the APT software suite. Run apt-cache show PACKAGE to get information about PACKAGE (whether it's installed or not). Run apt-cache policy PACKAGE to see a summary of installed and available versions of the package. Run apt-cache search FOO to search for packages whose description contains FOO.

Running apt-get update updates the local copy of the list of available packages that apt-cache queries. Ubuntu sets up a daily job to do that, so if your machine has an Internet connection, your machine will have an almost-up-to-date version (but it's still a good idea to run it manually just before installing or updating packages). apt-get update does not make any modification to the software installed on your machine. Running apt-get upgrade (or one of the XXX-upgrade variants) upgrades installed packages to the latest eligible version according to the local copy of the package lists.

The version shipped by Ubuntu may not be the latest version available from the original developer. Ubuntu compiles all programs from source (except for a few non-open-source ones), tests them if they're in main (not if they're in universe), and makes a release every 6 months, so you generally end up with software that's 3–9 months old. That's generally not a problem as it's quite rare to need the latest, untried version of a program. Critical bugs such as security issues do get quick updates outside of the release cycle (they're backported, i.e. the fix is applied to the version that was released, rather than shipping the latest version immediately). If you absolutely wanted the latest version, you could look for a PPA (a source of extra packages that is not maintained by Ubuntu, quality varies), or try the latest version from Debian unstable, or recompile the upstream source — but once again most people don't need that.


In addition to the classic /etc/apt/sources.list file, it will also read all files installed in


they work the same, but by having multiple files, managing gets easier (no automatic config file editing necessary).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .