Package Management in Linux

Debian and Ubuntu

Install a Package

$ apt-get install <package>
Example: $ apt-get install tree
tree is the package that is installed.
Check if a specific package is installed

$ dpkg -l | grep <package>

List all packages installed

$ dpkg –print-avail <package>
or
$ apt-cache show <package>

Find the location of files within a package

$ dkpg -L <package>
Redhat

You can manage packages using yum or rpm

Install a package

$ yum install <package>

Installing apache: $ yum install httpd

Upgrading a package

$ yum update <package>

Uninstalling a package

$ yum remove <package>

Installing a package with rpm

$ rpm -ivh <packagename.rpm>

Upgrading a package with rpm

$ rpm -uvh <packagename.rpm>

Remove a package with rpm

$ rpm -ev <package>