Back

aptitude 的搜索用法

|

我不明白为什么所有网站都推荐使用apt-get.它好像不提供软件删除功能吧.aptitude就很好, 举例说明:
在 gnome ubuntu 上装 kde:
sudo aptitude install kubuntu-desktop
如果想删除,则:
sudo aptitude remove kubuntu-desktop 就可以了。
aptitude的用法与 apt-get 几乎一样,只是多了一个自动删除依赖的功能。注意一点,只有使用aptitude安装的包才能自动删除依赖包.
aptitude提供一个强大的搜索功能.下面是一些用法.

* Alias 的设置。

alias ag='sudo aptitude safe-upgrade'
alias ai='sudo aptitude install'
alias ap='sudo aptitude purge'
alias ar='sudo aptitude remove'
alias as='aptitude search'
alias au='sudo aptitude update'
alias aw='aptitude show'

* 常用扩展描述缩写说明

?name ~n 软件名
?maintainer ~m 维护者
?installed ~i 已经安装
?description ~d 软件描述
?version ~V 版本
?virtual ~v 虚拟包
?broken ~b 破损包
?config-files ~c 删除了,配置还在的
?not ! 取反
?or(term1, term2) ~d"term1 | term2" 关键字“或”
?and(term1, term2) ~d"term1 term2" 关键字“与”
包含空格的写法
Daniel ~ Burrows "Debian Project" Debian" "Project

* 举例:

软件描述中,包含 2 个单词的任意一个的,已经安装的包,都删除。
ar ~d~i"virtualbox ose"
软件名中,包含 xfc e 或者 xfw m 的已经安装的包,列表显示出来。
as ~ixf(ce|wm)
彻底删除已经安装的,非目前使用的内核。
ap ~ilinux-image-.\*(!`uname -r`)
列出已经安装的,非 debia n 官方的包。
aptitude search '~S~ i!~Odebian'
列出软件名包含 'ruby' 和 'gtk' 的包。
aptitude search 'rub y gtk'
aptitude search ~nruby~ngtk
列出依赖 bash 的,已经安装的包。
aptitude search ~S~i ~Dbash
清除只有配置文件的,已经删除了的包。
aptitude purge ~c

另外,关于.bz2和.gz的问题.这两种都是linux下的压缩格式,我做过测试,相同大小的文件,使用bz2这个格式压缩的文件要稍微小一点,然而花费的压缩时间要长很多.性价比还是.gz比较高.个人推荐使用[7z](http://www.7-zip.org/).很不错的压缩方法,关键是免费且多平台,至少比rar要好吧.

No comments yet

Leave a comment

About me

I live in Tasmania, an island a little far from the rest of the world and very close to the sea.
Father of two little girls, have two puppies.

Work

Work in IT industry, AI is my working partner.