What is 'apt' and How can it help you



What is apt?

If you are a newbie, here's what apt is. apt or Advanced Package Tool is a free user interface or a Debian package management tool that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants. The actual command is 'apt-get'.

In simple words, if you need to install, remove and update packages apt is the tool for you. Here are 10 utilities that 'apt' can bring to your Linux machine:




1. Installing packages

Default use,

$ apt-get install package name

e.g. $ apt-get install gimp

To choose a particular version,

$ apt-get install package name=2.2

For source packages,

$ apt-get source package name

To compile the source packages after downloading them,

$ apt-get source -b package name

2. Re-installing packages

$ apt-get –reinstall install package name

3. Removing packages

$ apt-get remove package name (Note: this will not remove the configuration files)

for complete removal with configuration files

$ apt-get –purge remove package name

4. Upgrading packages

$ apt-get upgrade package name

Upgrade all the packages which needs an upgrade,

$ apt-get -u upgrade

To add a CD to the source list

$apt-get cdrom

To upgrade the whole distribution to a new version,

$ apt-get dist-upgrade

5. Searching for packages

$ apt-cache search package name

To list all the dependencies of a package and all the other packages that can fulfill that dependency,

$apt-cache depends package name

6. Checking installed versions or decide the source

$apt-cache policy 

7. Show full description of a package

$apt-cache show package

8. Check for any broken dependencies

$ apt-get check

9. Clear the cached packages

$ apt-get clean (This command removes everything from the /var/cache/apt and /var/cache/apt/archives directory.)

10. Remove packages that can no longer be downloaded

$ apt-get autoclean

Bonus Function for fun!

“This apt has Super Cow Powers”

$ apt-get moo

Other options provided with apt-get

-f : fix broken dependencies
-m : continue if archives are unlocatable
-u : show a list of upgraded packages as well
-s : reports on the status of the package listed