Comprehensive Guide to apt-get

Last time I wrote up a comprehensive guide to yum for Fedora, openSuse, etc.. It was well received so I decided to focus on Debian based systems this time.

Debian is known to be extremely stable and reliable, and for its excellent package manager, apt. That’s why user-friendly Ubuntu decided to advantage of Debian package features, along with a number of other distributions. Just to show how easy it is to install something, try this:

sudo apt-get install vlc

All dependencies will be automatically fetched and installed along with the application. How easy is that?

A busy apt-get command at work. Woot.
A busy apt-get command at work. Woot.

Here is a list of some commands that might be useful to you.

Update

sudo apt-get update
To update your package lists

sudo apt-get upgrade
To install the newest version of all packages

sudo apt-get dist-upgrade
To perform automatically upgrade all packages and dependencies.

Installation

sudo apt-get install package_name
Easy enough. Installing a package.

sudo apt-get --reinstall package_name
To re-install a package.

sudo apt-get install package_name1 package_name2 package_name3
To install multiple packages

sudo apt-get -d install package_name
To download the package only

sudo apt-get install package_name1 package_name2 package_name3 --dry-run
To test the command before executing

Removal

sudo apt-get remove package_name
To remove a package

sudo apt-get remove package_name --dry-run
To test the command before executing

sudo apt-get --purge remove package_name
To remove all traces of a package, including config files.

Maintenance

sudo apt-get check
To check for broken dependencies

sudo apt-get autoclean
To remove cached packages that are no longer needed

sudo apt-get clean
To remove all cached packages

Tips

As always, it is a good idea to look at the man page to learn more about a program’s specific features, and this one is no different.

man apt-get

You can also visit the official Debian apt-get home page here.

It is recommended (well, by me) that your system gets updated periodically, if it’s not already set to do that automatically. Linux is solid but the user is usually the weak link, so make sure you get into good habit of maintaining an up-to-date machine.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s