Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When i find a interesting program i want to test and install in ubuntu i first check if it's available in the repository. For that i use the software center.

But does a possibility exist to check it via commandline i.e. apt or aptitude? Similar apt get install command?

share|improve this question
add comment

3 Answers 3

up vote 11 down vote accepted

You can use any one of these commands,

apt-cache search <package_name>

aptitude search <package_name>

apt-cache policy <package_name>

sudo apt-get install <package_name> -s

Output:

karthick@Ubuntu-desktop:~$ sudo apt-get install sun-java6-jdk -s
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package sun-java6-jdk is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package sun-java6-jdk has no installation candidate
share|improve this answer
1  
You can prefix the keyword with ^ to denote starts-with, for example aptitude search ^deb which will list package names start with deb instead of contain deb. There maybe more control chars in the regex, but I don't know any more. –  Xiè Jìléi Dec 27 '10 at 7:02
add comment

You can install apt-file Install APT-FILE which allows you to search for file names in APT. For instances to find a binary nagios

marco@marco-desktop:~$ sudo apt-file search nagios3
aide-common: /usr/share/aide/config/aide/aide.conf.d/31_aide_nagios3
cherokee-doc: /usr/share/doc/cherokee-doc/media/images/cookbook_nagios3.png
nagios-images: /usr/share/nagios3/htdocs/images/logos/andrade
nagios-images: /usr/share/nagios3/htdocs/images/logos/base
nagios-images: /usr/share/nagios3/htdocs/images/logos/bernhard
nagios-images: /usr/share/nagios3/htdocs/images/logos/cook
nagios-images: /usr/share/nagios3/htdocs/images/logos/didier
nagios-images: /usr/share/nagios3/htdocs/images/logos/remus
nagios-images: /usr/share/nagios3/htdocs/images/logos/satrapa
nagios-images: /usr/share/nagios3/htdocs/images/logos/werschler
nagios3: /usr/share/doc/nagios3
nagios3: /usr/share/lintian/overrides/nagios3
nagios3-cgi: /etc/nagios3/cgi.cfg
nagios3-cgi: /etc/nagios3/stylesheets/avail.css
nagios3-cgi: /etc/nagios3/stylesheets/checksanity.css
nagios3-cgi: /etc/nagios3/stylesheets/cmd.css
nagios3-cgi: /etc/nagios3/stylesheets/common.css
nagios3-cgi: /etc/nagios3/stylesheets/config.css

It breaks down by package: file match

share|improve this answer
add comment

apt-cache search is what you want:

For example:

apt-cache search firefox

will return things with firefox in it. From the manpage:

search performs a full text search on all available package lists for the POSIX regex pattern given, see regex(7). It searches the package names and the descriptions for an occurrence of the regular expression and prints out the package name and the short description, including virtual package names. If --full is given then output identical to show is produced for each matched package, and if --names-only is given then the long description is not searched, only the package name is.

Separate arguments can be used to specify multiple search patterns that are and'ed together.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.