Ubuntu下如何查看软件安装目录及安装版本

1.查询版本
1)首先安装aptitude  sudo apt-get install aptitude
aptitude show 软件名
例如:aptitude show zip 

显示如下:

****@ubuntu:~$ aptitude show zip
Package: zip                      
State: installed
Automatically installed: yes
Version: 3.0-4
Priority: optional
Section: utils
Maintainer: Ubuntu Developers 
Architecture: i386
Uncompressed Size: 651 k
Depends: libbz2-1.0, libc6 (>= 2.7)
Recommends: unzip
Conflicts: zip-crypt (<= 2.30-2)
Replaces: zip-crypt (<= 2.30-2)
Description: Archiver for .zip files
 This is InfoZIP's zip program. It produces files that are fully compatible with
 the popular PKZIP program; however, the command line options are not identical. In
 other words, the end result is the same, but the methods differ. :-) 
 
 This version supports encryption.
Homepage: http://www.info-zip.org/Zip.html

2)dpkg -l软件名
 例如:dpkg -l mcrypt

***@ubuntu:~$ dpkg -l mcrypt 
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  mcrypt         2.6.8-1        Replacement for old unix crypt(1)
2.查询安装路径
1)dpkg -L 软件名
例如:dpkg -L mcrypt  

***@ubuntu:~$ dpkg -L mcrypt 
/.
/usr
/usr/share
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/mcrypt.1.gz
/usr/share/locale
/usr/share/locale/el
/usr/share/locale/el/LC_MESSAGES
/usr/share/locale/el/LC_MESSAGES/mcrypt.mo
/usr/share/locale/cs
/usr/share/locale/cs/LC_MESSAGES
/usr/share/locale/cs/LC_MESSAGES/mcrypt.mo
/usr/share/locale/pl
/usr/share/locale/pl/LC_MESSAGES
/usr/share/locale/pl/LC_MESSAGES/mcrypt.mo
/usr/share/locale/de
/usr/share/locale/de/LC_MESSAGES
/usr/share/locale/de/LC_MESSAGES/mcrypt.mo
/usr/share/locale/es_AR
/usr/share/locale/es_AR/LC_MESSAGES
/usr/share/locale/es_AR/LC_MESSAGES/mcrypt.mo
/usr/share/locale/sv
/usr/share/locale/sv/LC_MESSAGES
/usr/share/locale/sv/LC_MESSAGES/mcrypt.mo
/usr/share/doc
/usr/share/doc/mcrypt
/usr/share/doc/mcrypt/README
/usr/share/doc/mcrypt/TODO
/usr/share/doc/mcrypt/copyright
/usr/share/doc/mcrypt/changelog.gz
/usr/share/doc/mcrypt/changelog.Debian.gz
/usr/bin
/usr/bin/mcrypt
/usr/bin/crypt
/usr/share/man/man1/crypt.1.gz
/usr/share/man/man1/mdecrypt.1.gz
/usr/bin/mdecrypt


或者
2)whereis 软件名
例如:whereis mcrypt
***@ubuntu:~$ whereis mcrypt
mcrypt: /usr/bin/mcrypt /usr/bin/X11/mcrypt /usr/share/man/man1/mcrypt.1.gz

终端
在终端下也可以很方便查看已安装的软件包版本号,也能单独查看所需要的软件包是否已安装和版本号,还能查看可升级的软件包。在终端下要实现这个目标就要用到一个软件工具叫做apt-show-versions,通过apt-get安装:
$sudo apt-get install apt-show-versions


或者单击下面图标安装(仅在Ubuntu下的Firefox有效):
安装好之后就可以在终端下使用命令:
$apt-show-versions

来查看所有已安装的软件包和版本号,不过结果太多会一扫而过,加上终端的自有脚本more来打印每一屏的结果:
$apt-show-versions |more
这样子打印满一屏就暂停,按下回车键打印下一行,按下空格键打印下一屏,按下Q键退出打印结果。如果想查看单个软件包的版本,则使用命令:
$apt-show-versions –p    //是软件包名,不含符号
如果想查看可升级的软件包,则使用命令:
$apt-show-versions –u

其实有个更简单的方式
$sudo dpkg -l | grep

你可能感兴趣的:(Linux)