How to search for a package in Debian and Ubuntu

If you need to install a package such as mysql server you generally use the apt-get install <package name> command. The trick is getting the package name right. To find the package name, perform a search using the apt-cache command. The syntax is as follows:

apt-cache search mysql

This will return a list of packages which reference mysql. You’ll notice this is a very long list because it’ll include packages which include applications which use mysql databases. To narrow down your search you can use the following command:

apt-cache search mysql –names-only

This will return a list of packages where mysql is in the name of the package only. It’s a much shorter list but still lengthy. To narrow the results even further we can modify the search criteria. The apt-cache search criteria is a regular expression, which means to find a package which starts with mysql we would use this command:

apt-cache search ^mysql

The ^ basically means starts with. As you’ll see the list returned is much shorter and identifying the package you want will be much easier.

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • del.icio.us
  • Facebook
  • Twitter
  • Google Bookmarks

Leave a Reply

Your email address will not be published. Required fields are marked *

*