apt-get command in linux

In this blog you will learn linux apt-get command. This is complete beginner guides to learn about apt-get command in linux.

About apt-get :

 apt-get is the command line tool for working with APT software Packages.

APT( Advance Packaging Tool) is an evolution of the debian .deb software packaging system.

There are two main tool around it apt-get and apt-cache.

apt-get is for installing, upgrading, and cleaning packages and apt-cache used for finding packages.

 All these commands except the search commands must be run as root or with superuser privileges.

update Command
 
    apt-get works only on a database of available packages. Without update this database after fresh installation, the system won’t know if there are newer packages available or not. So, after fresh installation you must write this command first in any linux system.

You need to super user privileges to run this command so use sudo before this command.

    sudo apt-get update

Note: The package indexes/database fetched from the location specified in etc/apt/sources.list
An update should always be performed before an upgrade or dist-upgrade.

upgrade Command

After updating the package database, you can upgrade the installed packages.


sudo apt-get upgrade

To upgrade only a specific packages, use the command below:


sudo apt-get upgrade <package_name>

dist-upgrade command

This command will also upgrade the complete packages. This command actually looks for the dependencies with the newer version and tries to install it.
The dist-upgrade command may therefore remove some packages.

It sounds like dist-upgrade is more powerful and intelligent. But there is a risk with this command. Apt-get has a “smart” conflict resolution system and it will attempt to upgrade the most important packages at the expense of less important ones if necessary.  So you should avoid to use this command.

To use this command follow the command below :


sudo apt-get dist-upgrade

Note: The /etc/apt/sources.list file contains the list of locations from where package files will be retrieved.




Post a Comment

Previous Post Next Post