What Is “apt-get”? How to use that?

This article introduce the “apt-get” tool use in Debian Flavor Linux Operation System. This tool use to install and uninstall of different package in Linux. “apt” full known as “Advance packaging Tool”. In order to use this tool we need “Sudo” (Super User : Admin) . Now open terminal and type command as following.

  1. Installing packages$ apt-get install pkgName :

will Install package, if any package found dependency that will discover automatically and downloaded as well.

$ apt-get install package name=2.2

[ad name=”OpenX-1″]

To Install particular version.

In order to install with source code then us this Command “$ apt-get source pkgname” if you want to install source code as well as compile the package We use “-b” Command line as given below.

$ apt-get source -b package name

2. Re-installing packages

Now, We reinstall the same package use “$ apt-get –reinstall install packName”

3. Removing packages

“$ apt-get remove pkgName” will uninstall all file but keep configuration file as it is. Now to fully remove we use command “$ apt-get –purge remove pkgName”

4. Upgrading packages

Update Package “$ apt-get upgrade package name”. While Command “$ apt-get -u upgrade” Upgrade only needed package. Which save your Bandwidth and time.

5. Searching for packages

“$ apt-cache search package name” will 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

As we need to check the package description we will us “$apt-cache show package”. Now to check the dependencies if any broken then we use command “$ apt-get check”.

8. Clear the cached packages

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

9. Remove packages that can no longer be downloaded

$ apt-get autoclean

10. Bonus Function for fun!

“This apt has Super Cow Powers”

$ apt-get moo

11. 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

12 list all installed package

dpkg –get-selections

dpkg –get-selections | grep php (Display only PHP Related package)

 

 

This article inspired from [1].

Citation
[1] http://www.efytimes.com/e1/fullnews.asp?edid=114802

Share Post