Apt-get

From wiki-ben
Jump to: navigation, search

apt-get is Ubuntu's powerful command line program for package management.

Usage

For detailed useage information check out the man page: Ubuntu apt-get manual

Updating

A useful script for updating your system which I have saved /home/'username'/bin/update

echo "CHECKING:"
sudo apt-get check
echo "UPDATING:"
sudo apt-get update
echo "UPGRADING PACKAGES:"
sudo apt-get upgrade
echo "UPGRADING DEPENDENCIES:"
sudo apt-get dist-upgrade
echo "CHECKING:"
sudo apt-get check
echo "REMOVING OUTDATED:"
sudo apt-get autoremove
echo "CLEANING UP:"
sudo apt-get autoclean

Reinstall

Useful for when you want to reset an applications config files to default.

  1. (Optional)Verify what package the file belongs to:
    dpkg -S rsyslog.conf
    rsyslog: /etc/rsyslog.conf
  2. Rename or Delete the config file you want to restore:
    sudo mv /etc/rsyslog.conf /etc/rsyslog.conf.bak
  3. Reinstall the package:
    sudo apt-get -o Dpkg::Options::="--force-confmiss" install --reinstall <package-name>
  4. You should see:
    Configuration file '/etc/rsyslog.conf', does not exist on system.
    Installing new config file as you requested.

Notes

  • sudo apt-get check is not necessary, it is a diagnostic tool and checks for broken dependencies

Sources

Ubuntu Manual for apt-get
http://manpages.ubuntu.com/manpages/utopic/man8/apt-get.8.html