关于小悟志网站地图归档友情链接联系Feed

云上小悟 + 

首页 » InfoTech »

查询Ubuntu系统已安装的软件包?

InfoTech
2017年7月15日 / 74次阅读
标签:Linux

文章《查询Ubuntu系统已安装的软件包?》的特色图片

Linux下安装软件跟Windows不一样,由特别的命令来实现,比如Ubuntu的apt和dpkg,CentOS的yum,RedHat的rpm。

在Ubuntu系统中,使用apt相关命令来安装软件包,但是如何查询系统中已经安装了哪些软件包呢?(我要知道都安装了哪些,才能判断我不用的软件包,然后将其删除,释放磁盘空间)

 

Ubuntu中使用下面的命令来查询:

dpkg -l 

列出当前系统中所有的包.可以和参数less一起使用在分屏查看. (类似于rpm -qa)

使用管道功能,配合less命令可以更好的查看:

dpkg -l | less

还可以使用dpkg --get-selections命令,输出简洁。

 

如果要查询一个包的详细信息,使用:

xinlin@iZ239r252v4Z:~$
xinlin@iZ239r252v4Z:~$ dpkg -s gawk
Package: gawk
Status: install ok installed
Priority: optional
Section: interpreters
Installed-Size: 1516
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Architecture: amd64
Multi-Arch: foreign
Version: 1:4.1.3+dfsg-0.1
Provides: awk
Pre-Depends: libc6 (>= 2.15), libgmp10, libmpfr4 (>= 3.1.3), libreadline6 (>= 6.0), libsigsegv2 (>= 2.9)
Suggests: gawk-doc
Description: GNU awk, a pattern scanning and processing language
`awk', a program that you can use to select particular records in a
file and perform operations upon them.
.
Gawk is the GNU Project's implementation of the AWK programming language.
It conforms to the definition of the language in the POSIX 1003.2 Command
Language And Utilities Standard. This version in turn is based on the
description in The AWK Programming Language, by Aho, Kernighan, and
Weinberger, with the additional features defined in the System V Release
4 version of UNIX awk. Gawk also provides more recent Bell Labs awk
extensions, and some GNU-specific extensions.
Original-Maintainer: Arthur Loiret <aloiret@debian.org>
Homepage: http://www.gnu.org/software/gawk/
xinlin@iZ239r252v4Z:~$

 

用apt命令也可以查询已安装的包,还可以查询那些可以升级,不过个人感觉在查询已安装的包的时候,apt命令执行很慢,dpkg执行就要快很多。

查询已安装的包:

apt list --installed

查询那些软件包可以升级:

apt list --upgradable

 

注意,使用apt upgrade将会升级所有的可升级的软件包,如果只想升级某一个软件包,我找到的方法是重新安装这一个软件包:

xinlin@ubuntu:~$
xinlin@ubuntu:~$ apt list --upgradable | grep wget

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

wget/xenial-updates 1.17.1-1ubuntu1.2 amd64 [upgradable from: 1.17.1-1ubuntu1.1]
xinlin@ubuntu:~$
xinlin@ubuntu:~$ sudo apt install wget
[sudo] password for xinlin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be upgraded:
wget
1 upgraded, 0 newly installed, 0 to remove and 245 not upgraded.
Need to get 298 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 wget amd64 1.17.1-1ubuntu1.2 [298 kB]
Fetched 298 kB in 4s (69.1 kB/s)
(Reading database ... 205335 files and directories currently installed.)
Preparing to unpack .../wget_1.17.1-1ubuntu1.2_amd64.deb ...
Unpacking wget (1.17.1-1ubuntu1.2) over (1.17.1-1ubuntu1.1) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up wget (1.17.1-1ubuntu1.2) ...
xinlin@ubuntu:~$

本文链接:http://www.maixj.net/ict/linux-ruanjian-15976
云上小悟 麦新杰(QQ:1093023102)

相关文章

评论是美德

无力满足评论实名制,评论对非实名注册用户关闭,有事QQ:1093023102.


前一篇:
后一篇:

栏目精选


©Copyright 麦新杰 Since 2014 云上小悟独立博客版权所有 备案号:苏ICP备14045477号-1

网站二维码
拍拍贷
go to top