• apt-get moo
  • apt-get install xxxxx
  • apt-get remove xxxxx
  • apt-get purge xxxxx
  • apt-get update
    • updates repo infos, does not updates any package
  • apt-get upgrade
    • upgrades already installed packages to newer versions, but does not remove old versions and also does not install packages which are not installed + also does not upgrade package if it would mean to change status of other packages
    • does not update kernel
  • apt-get dist-upgrate¬† (= apt full-upgrade)
    • upgrades packages, handles changed dependencies, removes old versions – can cause problems on production servers if users are dependent on installed packages
    • updates kernel
  • apt-cache – check all/ installed packages:
    • search – check in repo infos
  • add-apt-repository ….

Using GUI “Software Updater” should be the same as “sudo apt-get update” + “sudo apt-get dist-upgrade”. Maybe with some minor differences based on GUI.

Check installed packages

  • dpkg –get-selections
    • gives quite a long list
  • dpkg –get-selections | grep postgres
    • shows only postgres packages
  • dpkg -l

Check dependencies for package

  • apt-cache shopkg packagename
    • shows files, MD5 hashes, reverse dependencies, dependencies, provides, revers provides

How to check when we used for the last time commands like “apt-get update” etc.

There are several ways how to do it, but it can happen that none of them will really work – all depends on installation.

  • Existing version of Ubuntu can be checked using:
    • lsb_release -a
    • cat /etc/*relea*¬† (works on every linux distro)
  • runs of apt-get can be checked in:
    • /var/log/apt/term.log
      • contains apt-get logs
      • but on some minimal installations may be empty
    • var/log/apt/history.log
      • contains full log of history of commands
      • to check for apt-get runs use:
        • cat /var/log/apt/history.log|grep -B1 ‘upgrade’|less
        • be aware that some lines can be very long
      • same story as term.log – on some minimal installations can be switched off and therefore empty
    • /var/log/dpkg.log
      • ls -alt /var/lib/dpkg/info | head -n 10
      • same story on minimal installs
    • /var/cache/apt/pkgcache.bin
      • ls -l /var/cache/apt/pkgcache.bin | cut -d’ ‘ -f6,7,8
      • stat /var/cache/apt/pkgcache.bin