Next Previous Contents

10. 其他常用指令介紹

10.1 dpkg

眾多 dpkg 的前端軟體套件管理工具

10.2 apt-setup

附圖 apt-setup1

附圖 apt-setup2

附圖 apt-setup3

附圖 apt-setup4

附圖 apt-setup5

附圖 apt-setup6

附圖 apt-setup7

附圖 apt-setup8

附圖 apt-setup9

附圖 apt-setup10

附圖 apt-setup11

附圖 apt-setup12

附圖 apt-setup13

附圖 apt-setup14

10.3 apt-cache

尋找軟體好工具

舉例說明:

假設今天我想上 icq 可是卻不清楚 debian 底下有什麼 icq 軟體可用?這時候 apt-cache 就是我們的好幫手,首先只要下底下指令:

apt-cache search icq

然後就可以看到一堆與 icq 這個 keyword 相關的軟體套件:

      moto@X20[~]$ apt-cache search icq
      centericq - A text-mode icq client based on ncurses
      everybuddy - An all in one messaging client
      everybuddy-cvs - All in one Instant Messaging client, cvs snapshots
      gabber - A GNOME Jabber client.
      gaim - GPL clone of AOL Instant Messenger - GTK version
      gaim-gnome - GPL clone of AOL Instant Messenger - GNOME version
      gnomeicu - Small, fast and functional clone of Mirabilis' ICQ
      jabber - Daemon for the jabber.org Open Source Instant Messenger
      konverse - a Jabber client for KDE
      libicq-dev - library implementation of Mirabilis ICQ (Development files)
      libicq1 - library implementation of Mirabilis ICQ
      licq - ICQ clone (base files)
      licq-dev - LICQ Development and Header Files
      licq-plugin-autoreply - LICQ auto-replyer plugin (noninteractive)
      licq-plugin-console - Text front-end plugin for LICQ
      licq-plugin-forwarder - LICQ message forwarder plugin
      licq-plugin-kde - Graphical front-end plugin for LICQ using QT2+KDE
      licq-plugin-qt2 - Graphical front-end plugin for LICQ using QT2
      licq-plugin-rms - LICQ remote management server for telnet LICQ access
      lyskom-server - Server for the LysKOM conference system
      psi - jabber client using qt
      vicq - A simple, Perl-based ICQ client
      

這樣的搜尋出來的軟體套件並非絕對是 icq 軟體,但是或多或少都會沾上邊,別擔心我們還可以利用底下命令來深入了解某個軟體套件,以 『 gaim 』為例子:

apt-cache show gaim

我們可以看到 gaim 軟體的詳細說明:

moto@X20[~]$ apt-cache show gaim| more
Package: gaim
Priority: optional
Section: net
Installed-Size: 932
Maintainer: Robert McQueen <[email protected]>
Architecture: i386
Version: 1:0.50-1
Replaces: gaim-gnome (<= 1:0.11.0pre14)
Depends: gaim-common (= 1:0.50-1), libc6 (>= 2.2.4-4), libgdk-pixbuf2 (>= 0.13.0
-1), libglib1.2 (>= 1.2.0), libgtk1.2 (>= 1.2.10-4), libperl5.6 (>= 5.6.1-6), xl
ibs (>> 4.1.0)
Suggests: ispell
Conflicts: gaim-gnome (<= 1:0.11.0pre14)
Filename: pool/main/g/gaim/gaim_0.50-1_i386.deb
Size: 367514
MD5sum: 5b0d7668433d8494cbeee27f3bf97942
Description: GPL clone of AOL Instant Messenger - GTK version
Gaim allows you to talk to anyone using AOL's Instant Messenger service
(you can sign up at http://www.aim.aol.com/). It contains many of the
same features as AOL's IM client while at the same time incorporating
many new features.
      

是不是很方便呢..:-)。

10.4 deborphan ( 檢查系統中無相依關係的 library package )

儘管 Debian 的軟體管理機制良好,但是仍舊有盲點存在,由其在於移除軟體部份,現在我們以安裝 kaffe 這個 package 為例:

    moto@X20[~]$ sudo apt-get install kaffe
    Reading Package Lists... Done
    Building Dependency Tree... Done
    The following extra packages will be installed:
      libgmp2
    The following NEW packages will be installed:
        kaffe libgmp2
    0 packages upgraded, 2 newly installed, 0 to remove and 0  not upgraded.
    Need to get 1421kB of archives. After unpacking 2151kB will be used.
    Do you want to continue? [Y/n] 
    

上列訊息大家應該都十分熟悉了,主要是說明 Debian 因為軟體相依性的關係找到要安裝 kaffe 必須要加裝 libgmp2 這套 library,依照一般狀況我們自然是選擇『 Y 』一起安裝囉。

但是如果我們今天想要反安裝 kaffe 時,系統卻不會連帶將當初加裝進來的 libgmp2 移除:

moto@X20[~]$ sudo apt-get remove kaffe
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
  kaffe 
  0 packages upgraded, 0 newly installed, 1 to remove and 0  not upgraded.
  Need to get 0B of archives. After unpacking 1972kB will be freed.
  Do you want to continue? [Y/n] 
    

這裡我們當然選『 Y 』將 kaffe 移除,但是問題是剛剛加裝進來的 libgmp2 這套 library 卻仍存在系統裡面,但卻沒有其他軟體需要它,上述只是單一個例子,系統用久了軟體裝多了,這種無相依性的 library 安靜的躺在系統裡的情況也會越多,用慣 Debian 的朋友多少也會跟筆者一樣對系統有些許的潔癖,既然無用何必留著。

『 deborphan 』 便是肩負檢查系統有無這類 library 責任的程式,我可以執行一下看看目前系統閒置中的 library :

    moto@X20[~]$ deborphan
    libgmp2
    

加一點巧思配合 Shell Script ,我們可以簡單的寫個 Shell 程式自動移除這些 library , 如果想要定時清掃,不妨再配合 crontab 機制:

#/bin/bash
for i in `deborphan`
do 
        apt-get --assume-yes remove $i
done
    

也可以下如下指令,更簡單:

deborphan | xargs apt-get --assume-yes remove

10.5 wajig

Simplified Debian package management front end Wajig is a single commandline wrapper around apt, apt-cache, dpkg, /etc/init.d scripts and more, intended to be easy to use and providing extensive documentation for all of its functions. . With a suitable sudo(1) configuration, most if not all package installation (as well as creation) tasks can be done from a user shell.

10.6 ar x package.deb ( 解開 .deb 檔)

以 xterm_4.1.0-16_i386.deb 為例:

$ ar x xterm_4.1.0-16_i386.deb

可以得到底下幾個檔案:

control.tar.gz data.tar.gz debian-binary

10.7 update 系列


Next Previous Contents