检查 ubuntu 12.04 中软件包消耗的内存

检查 ubuntu 12.04 中软件包消耗的内存

如何在 Ubuntu 12.04 中逐个检查已安装软件包(库)所消耗的内存?

答案1

ps_mem.py下载一个名为From here 的Python 脚本http://www.pixelbeat.org/scripts/

现在运行脚本:

sudo python ps_mem.py

输出将列出所有打开的包及其使用的内存:(这是我的一个示例)

$ sudo python ps_mem.py

Private  +   Shared  =  RAM used    Program

180.0 KiB +  14.0 KiB = 194.0 KiB   vnstatd
176.0 KiB +  22.5 KiB = 198.5 KiB   atd
196.0 KiB +  21.5 KiB = 217.5 KiB   cntlm
216.0 KiB +  23.0 KiB = 239.0 KiB   irqbalance
204.0 KiB +  36.0 KiB = 240.0 KiB   chrome-sandbox (2)
192.0 KiB +  50.0 KiB = 242.0 KiB   cat (2)
176.0 KiB +  70.0 KiB = 246.0 KiB   anvil
240.0 KiB +  29.0 KiB = 269.0 KiB   bicon.bin
196.0 KiB + 104.0 KiB = 300.0 KiB   sh (2)
272.0 KiB +  36.0 KiB = 308.0 KiB   cron
292.0 KiB +  20.0 KiB = 312.0 KiB   acpid
288.0 KiB +  38.0 KiB = 326.0 KiB   upstart-socket-bridge [updated]
304.0 KiB +  35.5 KiB = 339.5 KiB   rtkit-daemon
292.0 KiB +  61.0 KiB = 353.0 KiB   bmws
332.0 KiB +  26.5 KiB = 358.5 KiB   xinetd
292.0 KiB +  71.0 KiB = 363.0 KiB   log
344.0 KiB +  20.5 KiB = 364.5 KiB   gpg-agent
320.0 KiB +  56.0 KiB = 376.0 KiB   gnome-pty-helper (2)
364.0 KiB +  15.5 KiB = 379.5 KiB   ssh-agent
316.0 KiB +  82.5 KiB = 398.5 KiB   dovecot
364.0 KiB +  40.5 KiB = 404.5 KiB   upstart-udev-bridge [updated]
388.0 KiB +  37.0 KiB = 425.0 KiB   dnsmasq
300.0 KiB + 164.0 KiB = 464.0 KiB   pickup
348.0 KiB + 151.0 KiB = 499.0 KiB   master
420.0 KiB +  83.5 KiB = 503.5 KiB   dbus
472.0 KiB +  60.0 KiB = 532.0 KiB   xrdp-sesman
512.0 KiB +  20.0 KiB = 532.0 KiB   gbr3
504.0 KiB +  64.0 KiB = 568.0 KiB   gvfsd-burn
520.0 KiB +  50.5 KiB = 570.5 KiB   xrdp
552.0 KiB +  33.0 KiB = 585.0 KiB   bluetoothd
440.0 KiB + 166.0 KiB = 606.0 KiB   qmgr
528.0 KiB +  89.5 KiB = 617.5 KiB   geoclue-master
592.0 KiB +  97.5 KiB = 689.5 KiB   gvfs-afc-volume-monitor
660.0 KiB +  39.5 KiB = 699.5 KiB   usbsrvd
664.0 KiB +  91.0 KiB = 755.0 KiB   gvfs-gphoto2-volume-monitor
676.0 KiB +  86.0 KiB = 762.0 KiB   dbus-launch (2)
712.0 KiB +  82.0 KiB = 794.0 KiB   at-spi2-registryd
700.0 KiB + 115.5 KiB = 815.5 KiB   at-spi-bus-launcher
788.0 KiB +  90.0 KiB = 878.0 KiB   accounts-daemon
888.0 KiB + 152.0 KiB =   1.0 MiB   gnome-vfs-daemon
744.0 KiB + 299.5 KiB =   1.0 MiB   avahi-daemon (2)
336.0 KiB + 807.5 KiB =   1.1 MiB   udevd (3)
976.0 KiB + 174.0 KiB =   1.1 MiB   getty (6)
968.0 KiB + 183.0 KiB =   1.1 MiB   gvfsd (2)
960.0 KiB + 199.5 KiB =   1.1 MiB   sshd
  1.1 MiB + 149.5 KiB =   1.3 MiB   upowerd
  1.2 MiB +  97.0 KiB =   1.3 MiB   modem-manager
  1.1 MiB + 152.0 KiB =   1.3 MiB   gvfs-gdu-volume-monitor
776.0 KiB + 630.5 KiB =   1.4 MiB   nxd
  1.3 MiB + 108.0 KiB =   1.4 MiB   nmbd
  1.4 MiB +  45.0 KiB =   1.4 MiB   rsyslogd
  1.0 MiB + 400.0 KiB =   1.4 MiB   udisks-daemon (2)
  1.3 MiB + 175.0 KiB =   1.5 MiB   indicator-application-service
  1.4 MiB + 159.0 KiB =   1.5 MiB   dconf-service (2)
  1.5 MiB +  54.5 KiB =   1.5 MiB   init [updated]
  1.2 MiB + 397.0 KiB =   1.6 MiB   telepathy-logger
  1.4 MiB + 224.0 KiB =   1.6 MiB   whoopsie
  1.3 MiB + 356.5 KiB =   1.7 MiB   ubuntu-geoip-provider
  1.6 MiB + 112.5 KiB =   1.7 MiB   gvfsd-trash
  1.3 MiB + 488.0 KiB =   1.7 MiB   sudo
  1.8 MiB +  75.5 KiB =   1.9 MiB   freshclam
  1.6 MiB + 251.0 KiB =   1.9 MiB   cupsd
656.0 KiB +   1.2 MiB =   1.9 MiB   kdeinit4
  1.7 MiB + 220.5 KiB =   1.9 MiB   console-kit-daemon
  1.8 MiB + 109.0 KiB =   1.9 MiB   nacl_helper
  1.7 MiB + 247.5 KiB =   2.0 MiB   indicator-session-service
  1.7 MiB + 300.0 KiB =   2.0 MiB   unity-files-daemon
  2.2 MiB +  94.0 KiB =   2.3 MiB   polkitd
  2.2 MiB + 136.5 KiB =   2.3 MiB   gnome-keyring-daemon
  2.0 MiB + 378.0 KiB =   2.4 MiB   indicator-datetime-service
  2.4 MiB +  69.5 KiB =   2.5 MiB   gvfsd-metadata
  2.5 MiB +  88.5 KiB =   2.6 MiB   config
  1.2 MiB +   1.4 MiB =   2.6 MiB   winbindd (3)
  2.1 MiB + 440.5 KiB =   2.6 MiB   VBoxXPCOMIPCD
  2.4 MiB + 218.5 KiB =   2.6 MiB   gvfsd-http
  2.2 MiB + 506.0 KiB =   2.7 MiB   mission-control-5
  2.4 MiB + 335.0 KiB =   2.7 MiB   telepathy-salut
  2.5 MiB + 332.5 KiB =   2.9 MiB   gnome-fallback-mount-helper
  2.4 MiB + 548.0 KiB =   2.9 MiB   zeitgeist-daemon (2)
  1.2 MiB +   1.7 MiB =   2.9 MiB   klauncher
  2.9 MiB + 111.5 KiB =   3.0 MiB   arpwatch
  2.8 MiB + 376.5 KiB =   3.2 MiB   gdu-notification-daemon
  3.0 MiB + 220.5 KiB =   3.2 MiB   NetworkManager
  2.8 MiB + 452.0 KiB =   3.3 MiB   indicator-printers-service
  3.0 MiB + 378.5 KiB =   3.4 MiB   gnome-session
  3.0 MiB + 440.0 KiB =   3.5 MiB   gnome-screensaver
  3.3 MiB + 195.5 KiB =   3.5 MiB   timekpr
  2.8 MiB + 720.0 KiB =   3.5 MiB   lightdm (2)
  3.4 MiB + 161.0 KiB =   3.6 MiB   x2gocleansessio
  3.3 MiB + 233.0 KiB =   3.6 MiB   gvfsd-smb
  3.1 MiB + 605.0 KiB =   3.7 MiB   telepathy-indicator
  2.6 MiB +   1.4 MiB =   4.0 MiB   smbd (2)
  4.1 MiB + 234.0 KiB =   4.3 MiB   gconfd-2 (2)
  3.9 MiB + 685.0 KiB =   4.5 MiB   e-addressbook-factory
  4.0 MiB + 770.0 KiB =   4.7 MiB   pulseaudio
  3.3 MiB +   1.8 MiB =   5.0 MiB   goa-daemon
  3.8 MiB +   1.4 MiB =   5.2 MiB   zeitgeist-fts (2)
  5.6 MiB + 317.5 KiB =   5.9 MiB   indicator-sound-service
  5.6 MiB + 491.0 KiB =   6.1 MiB   bamfdaemon
  5.6 MiB + 458.5 KiB =   6.1 MiB   unity-lens-util
  5.4 MiB + 759.0 KiB =   6.1 MiB   nm-applet
  6.1 MiB +  64.0 KiB =   6.2 MiB   teamviewerd
  6.1 MiB + 603.0 KiB =   6.7 MiB   polkit-gnome-authentication-agent-1
  5.8 MiB + 989.5 KiB =   6.8 MiB   VBoxSVC
  6.3 MiB + 582.5 KiB =   6.9 MiB   update-notifier
  6.5 MiB + 442.0 KiB =   7.0 MiB   unity-scope-cal
  6.3 MiB + 738.5 KiB =   7.0 MiB   notify-osd
  7.2 MiB +  38.0 KiB =   7.2 MiB   glusterd
  7.0 MiB + 433.0 KiB =   7.5 MiB   dbus-daemon (4)
  6.9 MiB + 625.0 KiB =   7.5 MiB   system-service-
  7.0 MiB + 522.5 KiB =   7.5 MiB   colord
  6.4 MiB +   2.2 MiB =   8.6 MiB   postgres (5)
  8.7 MiB + 552.0 KiB =   9.2 MiB   unity-lens-vide
  5.9 MiB +   3.3 MiB =   9.3 MiB   kded4
  3.3 MiB +   6.1 MiB =   9.4 MiB   monitorix-httpd
  8.7 MiB + 801.0 KiB =   9.5 MiB   bash (2)
  9.0 MiB + 577.5 KiB =   9.5 MiB   unity-scope-cit
  3.8 MiB +   6.1 MiB =  10.0 MiB   /usr/bin/monito
  9.7 MiB + 867.0 KiB =  10.5 MiB   indicator-timek
  3.9 MiB +   7.3 MiB =  11.2 MiB   apache2 (6)
 11.1 MiB + 602.5 KiB =  11.7 MiB   gtk-window-decorator
 11.8 MiB +   1.2 MiB =  13.0 MiB   nxclient.bin
 12.7 MiB + 835.0 KiB =  13.5 MiB   python2.7
 12.9 MiB +   1.2 MiB =  14.1 MiB   unity-applications-daemon
 14.3 MiB + 200.5 KiB =  14.5 MiB   twistd
 11.7 MiB +   3.0 MiB =  14.7 MiB   empathy
 13.5 MiB +   1.8 MiB =  15.4 MiB   gnome-terminal (2)
  3.1 MiB +  15.2 MiB =  18.2 MiB   bmcapture
 17.3 MiB +   2.5 MiB =  19.7 MiB   uget-gtk
 20.9 MiB + 336.5 KiB =  21.2 MiB   indicator-messages-service
 20.2 MiB +   1.1 MiB =  21.3 MiB   gnome-settings-daemon
 23.0 MiB + 718.0 KiB =  23.7 MiB   unity-music-daemon
 34.5 MiB + 314.0 KiB =  34.8 MiB   gvfs-fuse-daemon (2)
 39.0 MiB + 920.5 KiB =  39.9 MiB   unity-scope-vid
 41.4 MiB +  76.0 KiB =  41.5 MiB   mysqld
 40.1 MiB +   2.1 MiB =  42.2 MiB   nxnode.bin
 43.6 MiB +   1.0 MiB =  44.6 MiB   unity-panel-service
 45.1 MiB + 515.0 KiB =  45.6 MiB   ajenti-panel
101.0 MiB +   3.9 MiB = 104.9 MiB   nxserver.bin (2)
113.2 MiB +   5.4 MiB = 118.6 MiB   rhythmbox
122.6 MiB +   7.3 MiB = 129.9 MiB   okular
155.8 MiB +   1.7 MiB = 157.5 MiB   thunderbird
156.1 MiB +   2.4 MiB = 158.5 MiB   liferea
154.6 MiB +   5.4 MiB = 160.0 MiB   nautilus
228.7 MiB +  10.4 MiB = 239.1 MiB   Xorg
239.3 MiB +   1.3 MiB = 240.6 MiB   remmina
252.6 MiB + 169.5 KiB = 252.8 MiB   hud-service
365.8 MiB +   5.3 MiB = 371.0 MiB   compiz
381.1 MiB +  81.3 MiB = 462.3 MiB   chrome (15)
  3.6 GiB +  32.7 MiB =   3.7 GiB   VirtualBox (3)
---------------------------------
                          6.8 GiB
=================================

如果您更喜欢 GUI,您可以使用该system monitor应用程序。从仪表板中搜索它。打开后,转到进程选项卡。

在此处输入图片描述

答案2

dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n

显示...

    26  libjpeg8
    27  fonts-guru
    27  linux-generic
    27  linux-headers-generic
    27  linux-image-generic
    27  qtdeclarative5-accounts-plugin
    29  libjson0
    29  libperl5.20
    30  init
    ...
  85054 thunderbird
  85762 mysql-workbench
  89684 liboxideqtcore0
  95975 firefox
 128150 libreoffice-core
 155290 linux-image-extra-3.19.0-9-generic
 155437 linux-image-extra-3.19.0-7-generic
 156815 linux-image-extra-3.19.0-15-generic
 156815 linux-image-extra-3.19.0-16-generic
 156860 linux-image-extra-3.19.0-18-generic
 186640 chromium-browser

有两个有趣的命令:

dpigs

(列出最大的已安装软件包(在 Debian/Ubuntu 上))。安装后,您可以使用以下命令使用它 debian-goodies

sudo apt-get install  debian-goodies

wajig large 

(列出您安装的最大软件包)。需要安装 wajig sudo apt-get install wajig


dpigs
186640 chromium-browser
156860 linux-image-extra-3.19.0-18-generic
156815 linux-image-extra-3.19.0-16-generic
156815 linux-image-extra-3.19.0-15-generic
155437 linux-image-extra-3.19.0-7-generic
155290 linux-image-extra-3.19.0-9-generic
128150 libreoffice-core
95975 firefox
89684 liboxideqtcore0
85762 mysql-workbench

wajig large
Package                           Size (KB)        Status
=================================-==========-============
libreoffice-draw                    10,071      installed
libgcc-4.9-dev                      10,251      installed
libc6                               10,568      installed
fonts-freefont-ttf                  10,613      installed
guile-2.0-libs                      11,434      installed
ubuntu-touch-sounds                 11,626      installed
grub-common                         11,704      installed
poppler-data                        11,853      installed
libstdc++-4.9-dev                   11,937      installed

相关内容