Lew*_*ard 43 package-management
我想在我的机器上有一个已安装软件的列表,以及它们消耗的磁盘空间。我希望能够按最大/最小订购,但这不是必需的。
我是那种会安装软件来试用的人,从不自己清理。
结果,我的 7GB(Windows 和我的数据在不同的分区上,以及一个交换区)Ubuntu 11.04 分区受到影响,并且已经开始定期显示警告消息。
Flo*_*sch 31
dpkg-query -W -f='${Installed-Size;8} ${Package}\n' | sort -n
Run Code Online (Sandbox Code Playgroud)
显示按尺寸排序的包裹清单
Rol*_*Xor 23
首先确保您启用了“安装大小”和“下载大小”列(或者如果需要,只启用一个)。
enz*_*tib 18
我找到了一个较短的答案,不需要aptitude
:
dpkg-query -Wf '${Installed-size}\t${Package}\n' | column -t
Run Code Online (Sandbox Code Playgroud)
的show
命令aptitude
能够显示安装包的大小。
我有这个小脚本,它利用aptitude
(单独安装)来列出所有已安装包的大小:
#!/bin/bash
export LC_ALL=C
aptitude show $(dpkg-query -Wf '${Package}\n') |
awk '$1 == "Package:" { name = $2 }
$1 == "Uncompressed" { printf("%10s %s\n", $3, name) }' |
awk '$1 ~ /k/ { $1 *= 1 }; $1 ~ /M/ { $1 *= 1024 }
{ printf("%9d %s\n", $1, $2)}'
Run Code Online (Sandbox Code Playgroud)
大小以千字节表示,并且是近似值,由 返回aptitude show pkg
。
可以使用单个awk
调用来改进脚本(但我很懒:-)
另一种选择是使用包中的dpigs
应用debian-goodies
程序:
NAME
dpigs - Show which installed packages occupy the most space
SYNOPSIS
dpigs [options]
DESCRIPTION
dpigs sorts the installed packages by size and outputs the largest ones. Per
default dpigs displays the largest 10 packages. You can change this value by
using the -n option (see "OPTIONS"). The information is taken from the dpkg
status file with grep-status(1).
OPTIONS
-h, --help
Display some usage information and exit.
-n, --lines=N
Display the N largest packages on the system (default 10).
-s, --status=FILE
Use FILE instead of the default dpkg status file (which is /var/lib/dpkg/status
currently).
-S, --source
Display the largest source packages of binary packages installed on the system.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
23761 次 |
最近记录: |