让Debian不长一点赘肉

发表于:2007-07-04来源:作者:点击数: 标签:
介绍Debian里一个删除无用软件的工具debfoster,原文看这里 指令名稱: debfoster 簡要功能說明: 去除 debian 中沒有用到的package, 以避免經過日積月累的使用後, 系統中多了一堆用不到的 package 詳細說明:各位應該都有過這種經驗, 有時安裝了某個 package,
介绍Debian里一个删除无用软件的工具debfoster,原文看这里

指令名稱:debfoster

簡要功能說明:去除 debian 中沒有用到的package, 以避免經過日積月累的使用後, 系統中多了一堆用不到的 package

詳細說明:各位應該都有過這種經驗, 有時安裝了某個 package, 結果由於 dependency, 裝了一大堆的 packages,等到你覺得這個 package 不想用了, 要將之除去而後快時, apt-get 並無法將之前因為 dependency 而裝的所有packages 給全部清乾淨, 尤其是一些 develop 的 library。而某些時候就算是知道那些 package,但是要一一手動去刪, 也是很麻煩的。
另外, debfoster 也可拿來安裝和移除 package 用, 方便好用。
由於 debfoster 必須要知道目前系統中那些 package 是要留著, 那些要移除, 所以剛裝好時, debfoster會問你一坨問題, 那個 package 要保留, 所以第一次是比較辛苦的, 等到全部回答完成後, 以後有安裝新的 package,就只會問你新的 package 要不要保留, 如果不確定那是什麼東東, 可按 I or ? 來看目前這個 package 的資訊,以確定是否移除。
debfoster 也只是 apt-get 和 dpkg 的 frontend 而已。

參數:
Command line options
-v, --verbose
debfoster will show which packages have disappeared, have become
dependencies or (if Quiet is enabled) have become orphans.

-V, --version
Display version and copyright information.

-h, --help
Display a concise summary of the available options and argument
syntax.

-f, --force
Don't ask anything and assume 'no' as the answer to all questions.
It also installs any packages that seem to be missing, thus forc-
ing your system to comply with the debfoster database. Can have
'interesting' results if you're not careful.

-q, --quiet
Don't ask anything and assume 'yes' as the answer to all ques-
tions. Useful to create an initial /var/lib/debfoster/keepers
file or to recreate it after changing the configuration file.

-m, --mark-only
Instructs debfoster to make changes to the keeper file but not to
actually install or delete any packages. This can be used to
'edit' a keeper file by invoking debfoster one or more times in a
row. The changes can then be committed by invoking debfoster with
the --force option, which will delete/install any necessary pack-
ages. This is mainly useful for scripts and frontends, but may be
useful from the command line as well.

-u, --upgrade
If used as 'debfoster -u package' it will install or upgrade the
packages specified on the command line and try to upgrade all
packages that it relies on.

-c, --config file
Specify a different configuration file to use.

-k, --keeperfile file
Specify a different debfoster database to use.

-n, --no-keeperfile
Don't read the debfoster database and start with an empty list.

-i, --ignore-default-rules
This will instruct debfoster to ignore the UseHold, UseEssential,
MaxPriority, KeepSections, and NokeepSections settings in the con-
fig file (i.e., assume that any package can be an orphan). This is
a good option for those who really want to make sure their system
is squeaky clean. It's also useful when sharing or transferring a
keeper file between multiple machines where different config files
can cause some confusion. Properly used, -i eliminates that uncer-
tainty.

-a, --show-keepers
Lists the contents of the debfoster database.

-s, --show-orphans
List all orphaned packages that are not mentioned in the debfoster
database.

-d, --show-depends package
List all packages that this package depends on.

-e, --show-dependents package
List all packages in the debfoster database that depend on this
package.

-p, --show-providers package
List all packages that provide the dependency target specified by
package (e.g. "debfoster -p x-terminal-emulator" ).

-r, --show-related package
List all packages that are only installed because this package
depends on them.

-t, --use-tasks
Make tasks visible as packages. This will make tasks that are
selectable using tasksel(1) appear as packages named task-<label>.

-o, --option opt=val
Override any configuration option specified in the configuration
file.

範例:

debfoster --quiet
告訴 debfoster 不要問問題, 所有的問題都當成是 yes, 可用在第一次使用 debfoster 時, 將目前系統上的 packages 都保留。

debfoster gaim
安裝 gaim

debfoster gaim-
移除 gaim 和其他的 dependencies, debfoster 只會移除目前沒有任何 dependency 的 package, 所以不必怕執行後會有其他程式無法執行。

debfoster
不加任何參數, 如目前有新的 package, 會問你要不要保留, 如果是之前已告知要移除的 package, 則不會再各別問, 會直接將之全部移除

debfoster --show-keepers
顯示目前那些 packages 設為保留和不保留的列表

debfoster --show-depends wget
顯示要裝 wget 之前必須先安裝那些 packages

debfoster --show-dependents wget
顯示目前系統中有那些 package 會用到 wget

debfoster --upgrade wget
如果當初選定 wget 要移除, 下次又重新安裝 wget 時, debfoster 不會問要不要保留, 而是會直接刪除, 要是現在突然又想保留 wget 了, 只要下了這行指令, wget 就會跑到保留的行列, 不會自動被刪除。


由於某些參數沒有完全研究透轍, 只說明幾個較常用的, 其他的就請自行研究了, 當然, 有人要補充更好 javascript:window.open(this.src);" style="CURSOR: pointer" onload="return imgzoom(this,550)"> 。

debfoster 的使用時機是每次執行 dpkg 或 apt-get 有新增或刪除 package 之後, 多用有益身心健康, 讓 debian 的身材維持苗條。

不知各位看倌是不是有看沒有懂, 連我都寫得霧剎剎了, 沒關係, 只要給他用力的執行下去, 就會懂了

原文转自:http://www.ltesting.net