{eks}catid=87|keyword=terminal|teaser|alpha{/eks}

 

Ubuntu documentation

apt-get Maintenance commands

  • apt-get update

    Run this command after changing /etc/apt/sources.list or /etc/apt/preferences . For information regarding /etc/apt/preferences, see PinningHowto. Run this command periodically to make sure your source list is up-to-date. This is the equivalent of "Reload" in Synaptic or "Fetch updates" in Adept.

  • apt-get upgrade
    This command upgrades all installed packages. This is the equivalent of "Mark all upgrades" in Synaptic.
  • apt-get dist-upgrade
    The same as the above, except add the "smart upgrade" checkbox. It tells APT to use "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.

    IconsPage/IconNote.png "apt-get dist-upgrade" does not perform distribution upgrade. See [http://www.ubuntu.com/getubuntu/upgrading upgrading] for more information.

  • apt-get check
    This command is a diagnostic tool. It does an update of the package lists and checks for broken dependencies.
  • apt-get -f install

    This command does the same thing as Edit->Fix Broken Packages in Synaptic. Do this if you get complaints about packages with "unmet dependences".

  • apt-get autoclean

    This command removes .deb files for packages that are no longer installed on your system. Depending on your installation habits, removing these files from /var/cache/apt/archives may regain a significant amount of diskspace.

  • apt-get clean

    The same as above, except it removes all packages from the package cache. This may not be desirable if you have a slow internet connection, since it will cause you to redownload any packages you need to install a program.

    • The package cache is in /var/cache/apt/archives . The command

      du -sh /var/cache/apt/archives
      will tell you how much space cached packages are consuming.
  • dpkg-reconfigure <package_name>
    Reconfigure the named package. With many packages, you’ll be prompted with some configuration questions you may not have known were there.
    • IconsPage/example.png For example:

      dpkg-reconfigure fontconfig-config
      will present you with a "wizard" on configuring fonts in Ubuntu.
  • echo "<package_name> hold" | dpkg --set-selections

    This command places the desired package on hold.

    • IconsPage/info.png This command may have the unintended side effect of preventing upgrades to packages that depend on updated versions of the pinned package. apt-get dist-upgrade will override this, but will warn you first. If you want to use this command with sudo, you need to use echo "<package_name> hold" | sudo dpkg --set-selections not sudo echo "<package_name> hold" | dpkg --set-selections.

  • echo "<package_name> install" | dpkg --set-selections
    This command removes the "hold" or "locked package" state set by the above command. The note above about sudo usage applies to this command.