[Ubuntu10.04] Apt-get指令用法和yum對照

我是Fedora派的,不管是Cent OS或Fedora都好好用
但我又被ubuntu的強大視窗特效和親合力很高的圖型介面所吸引
不過ubuntu是用debian系列的,指令介面用起來還是有點卡卡的,試試看也不錯。

我紀錄一下這指令用法,和做一些對照,YUM比較常用

引用:http://wiki.debian.org.hk/w/Install_software_with_APT

更新最新的軟件資料 (apt-get update)

YUM指令對照:yum update

在系統管理員帳戶(即root)下打「apt-get update」更新最新的軟件資料:

# apt-get update
下載:1 ftp://ftp.hk.debian.org stable/main Packages [3577kB]
已有 http://deb.opera.com stable/non-free Packages
略過 http://deb.opera.com stable/non-free Release
下載:2 ftp://ftp.hk.debian.org stable/main Release [82B]
下載:3 ftp://ftp.hk.debian.org stable/main Sources [1415kB]
讀取 4992kB 用了 11s (159kB/s)
讀取套件清單中... 完成

搜尋軟件 (apt-cache search)

YUM指令對照:yum search 關鍵字

先用 “apt-cache search 關鍵字 ...” 搜尋軟件:

$ apt-cache search image manipulate
cinepaint - motion picture image painting and retouching tool
fujiplay - Interface for Fuji digital cameras
gnubik - 3D Rubik's cube game
gtkmorph - Digital image warp and morph (gtk)
gtkmorph-example - digital image warp and morph, examples
imagemagick - Image manipulation programs
jhead - manipulate the non-image part of Exif compliant JPEG files
jpegpixi - Remove hot spots from JPEG images with minimal quality loss

安裝軟件 (apt-get install)

YUM指令對照:yum install  套件名稱

apt-get install 套件名稱

# apt-get install imagemagick
Reading Package Lists... Done
Building Dependency Tree... Done
Suggested packages:
html2ps lpr
The following NEW packages will be installed:
imagemagick
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0B/1466kB of archives.
After unpacking 5325kB of additional disk space will be used.
Selecting previously deselected package imagemagick.
(Reading database ... 60636 files and directories currently installed.)
Unpacking imagemagick (from .../imagemagick_6%3a6.0.6.2-2.4_i386.deb) ...
Setting up imagemagick (6.0.6.2-2.4) ...

移除軟件 (apt-get remove)

要移除套件,可以在系統管理員帳戶(即root)下打「apt-get remove 套件名稱」,APT就會把所指定的套件和相依的套件一併移除。不過apt-get remove不會移除套件所屬的設定檔,要把設定檔也一併移除,就要加入選項「--purge」。

YUM指令對照:yum erase 套件名稱

# apt-get --purge remove imagemagick
Reading Package Lists... Done
Building Dependency Tree... Done
The following packages will be REMOVED:
imagemagick*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
Need to get 0B of archives.
After unpacking 5325kB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 60867 files and directories currently installed.)
Removing imagemagick ...
Purging configuration files for imagemagick ...

顯示個別軟件詳細資訊 (apt-cache show) (很少用)

YUM指令對照:yum list 套件名稱

如果想知道個別套件詳細資訊,可以打 "apt-cache show 套件名稱":

$ apt-cache show imagemagick
Package: imagemagick
Priority: optional
Section: graphics
Installed-Size: 5200
Maintainer: Ryuichi Arafune <[email protected]>
Architecture: i386
Version: 6:6.0.6.2-2.4
Replaces: imagemagick-doc, geomview (<= 1.8.0)
Depends: libmagick6 (= 6:6.0.6.2-2.4)
Suggests: gs, html2ps, lpr
Conflicts: imagemagick-doc
Filename: pool/main/i/imagemagick/imagemagick_6.0.6.2-2.4_i386.deb
Size: 1465598
MD5sum: 4b9eb6cda5f5fe0c20040c9647ee2b6f
Description: Image manipulation programs
Imagemagick is a set of programs to manipulate various image formats
(JPEG, TIFF, PhotoCD, PBM, XPM, etc...). All manipulations can
be achieved through shell commands as well as through a X11 graphical
interface (display).
.
Possible effects: colormap manipulation, channel operations, thumbnail
creation, image annotation, limited drawing, image distortion, etc...
.
This package suggests a postscript interpreter (gs) to read postscript
files. It will however function happily without it (as long as you don't
want to read postscript).