Thursday 18 April 2013

Tricks for Apt-get command in Ubuntu

Tricks for Apt-get

If you are into the world of Linux or thinking of trying it out, you will most probably stumble upon apt. Due to the increase trend of people shifting to Debian distribution, apt now has become a must know tool.
In fact, apt-get will make your life so easy in Linux that you will stop worrying about how to install and remove software on the Debian GNU/Linux distributions.
So what’s apt?
APT or Advanced Package Tool is basically a Debian package management utility that works with core libraries to handle the installation and removal of software on the Debian GNU/Linux distribution and its variants.
In simple words, if you need to install , remove and update packages apt is the perfect tool for you.

1. Installing packages

Default use,
$ apt-get install < package-name >
e.g. $ apt-get install vlc
To choose a particular version,
$ apt-get install < package-name=1.1 >
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 > (Remember : this will not remove the configuration files)
for complete removal ( i.e. with configuration file )
$ 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 <package-name >

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
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
For more information, visit   http://wiki.debian.org/Apt  or $apt-get –help
Try this when you are free, “This Apt has Super Cow Powers” :) ,
$ apt-get moo
        

Enjoy .......

No comments:

Post a Comment