Linux 如何查找ubuntu中安装的软件版本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14727450/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 18:56:48  来源:igfitidea点击:

How to find version of a software installed in ubuntu

linuxshellubuntucommand-lineubuntu-12.04

提问by hemal12

Is there any universal command that I can use in the console, for example how to find the mysql version ?

是否有任何通用命令可以在控制台中使用,例如如何查找 mysql 版本?

采纳答案by Carsten

You can use dpkgto get that info:

您可以使用dpkg来获取该信息:

dpkg -l mysql-server | grep -E "^ii" | tr -s ' ' | cut -d' ' -f3

This will give you the installed version of the mysql-serverpackage.

这将为您提供已安装的mysql-server软件包版本。

If a package is not installed, it will print out "No packages found matching mysql-server." instead.

如果一个包没有安装,它会打印出“No packages found matching mysql-server”。反而。

回答by Shahbaz

Almost all programs that can be run in the command line have a --versionoption.

几乎所有可以在命令行中运行的程序都有一个--version选项。

For example:

例如:

git --version
ls --version

The format of their output is nowhere near standard though. Some make it easier to parse, some (often) include a little information about the license.

不过,他们的输出格式远不及标准。有些使它更容易解析,有些(通常)包含有关许可证的一些信息。