当我找到一个有趣的程序并想在 ubuntu 中测试和安装时,我首先会检查它是否在存储库中。为此,我会使用软件中心。
但是是否有可能通过命令行(例如 apt 或 aptitude)进行检查?类似 apt get install 命令?
答案1
您可以使用以下任意一个命令,
apt-cache search <package_name>
aptitude search <package_name>
apt-cache policy <package_name>
sudo apt-get install <package_name> -s
输出:
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
答案2
您可以安装apt-file
它,它允许您在 APT 中搜索文件名。例如,要查找二进制文件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
它分解为package: file match