现在的位置: 首页 > 综合 > 正文

apt小技巧

2013年05月18日 ⁄ 综合 ⁄ 共 695字 ⁄ 字号 评论关闭
你想找个软件包大概叫foo什么,于是apt-cache search foo,哇,一屏幕,不光名字,连软件包描述里带有关键字的都被搜出来了。你说,我知道,要加参数--names-only,可是每次敲这个也很麻烦。

你打apt-get upgrade,列出了一大堆要升级的软件包,可是到底升级到什么版本呢,系统默认设置没有告诉你。

你像我一样有洁癖,删除软件总喜欢purge,每次手写--purge参数,不是轻松的事情 :(

怎么办?

其实很简单,apt系统有个统一的配置文件:/etc/apt/apt.conf (若没有手动建立一个),把自己喜欢的规则写进去即可。

以下是小弟的设置,其意不言自明,更多参数,可以参见apt-*的man pages

APT::Default-Release "testing";
APT::Get::Show-Upgraded "true";
APT::Get::Purge "true";
APT::Get::Show-Versions "true";
APT::Cache::NamesOnly "true";
#######实现testing 和unstable共存##########
假設您使用的是 testing, 先在 source.list 中把 stable、testing 和 unstable 都列上去, 然後, 在 /etc/apt/apt.conf 中設定:

APT::Default-Release "testing";

這樣就可以了。
如果要裝 unstable 的套件, 請用

apt-get install -t unstable <pkg-name>

同理可以裝 stable 的套件, 不過請注意 libc 等套件的版本問題喔!

抱歉!评论已关闭.