注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

My Unix World

不要迷恋Unix,Unix只是计算世界很小的一部分!

 
 
 

日志

 
 

10. 其他常用指令介绍   

2008-11-06 22:58:46|  分类: L-M-System |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

10. 其他常用指令介绍

10.1 dpkg

  • dpkg -l package_name ( 列出該package 相關資訊) dpkg -l package_name (列出该package相关资讯)
  • dpkg -l | less ( 列出系統中所有安裝的軟體) dpkg -l | less (列出系统中所有安装的软体)
  • dpkg -L package_name ( 列出該package 所有檔案擺放位置) dpkg -L package_name (列出该package所有档案摆放位置)
  • dpkg -S file_name ( 搜尋file 所屬package ) dpkg -S file_name (搜寻file所属package )
  • dpkg -i package_name ( 軟體安裝) dpkg -i package_name (软体安装)
  • dpkg -r package_name ( 軟體移除) dpkg -r package_name (软体移除)
  • dpkg -x package_name.deb target_dir ( 解.deb 檔案成數個檔案) dpkg -x package_name.deb target_dir (解.deb档案成数个档案)
  • dpkg -i --force-overwrite-i package_name ( 強制安裝軟體) dpkg -i --force-overwrite-i package_name (强制安装软体)
  • dpkg -i --force-all package_name ( 不顧一切的強制安裝軟體) dpkg -i --force-all package_name (不顾一切的强制安装软体)
  • dpkg -r --purge --force-deps package_name ( 強制移除軟體) dpkg -r --purge --force-deps package_name (强制移除软体)
  • dpkg --get-selections ( 列出系統中所有安裝的軟體) dpkg --get-selections (列出系统中所有安装的软体)
  • dpkg --pending --remove ( 移除多餘的軟體) dpkg --pending --remove (移除多余的软体)

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

10.2 apt-setup

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup1 附图apt-setup1

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup2 附图apt-setup2

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup3 附图apt-setup3

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup4 附图apt-setup4

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup5 附图apt-setup5

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup6 附图apt-setup6

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup7 附图apt-setup7

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup8 附图apt-setup8

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup9 附图apt-setup9

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup10 附图apt-setup10

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup11 附图apt-setup11

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup12 附图apt-setup12

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup13 附图apt-setup13

10. 其他常用指令介绍  - liqi.xie - My Unix World 附圖apt-setup14 附图apt-setup14

10.3 apt-cache

尋找軟體好工具寻找软体好工具

  • apt-cache search keyword apt-cache search keyword
  • apt-cache show package_name apt-cache show package_name

舉例說明:举例说明:

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

apt-cache search icq apt-cache search icq

然後就可以看到一堆與icq 這個keyword 相關的軟體套件:然后就可以看到一堆与icq这个keyword相关的软体套件:

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

這樣的搜尋出來的軟體套件並非絕對是icq 軟體,但是或多或少都會沾上邊,別擔心我們還可以利用底下命令來深入了解某個軟體套件,以『 gaim 』為例子:这样的搜寻出来的软体套件并非绝对是icq软体,但是或多或少都会沾上边,别担心我们还可以利用底下命令来深入了解某个软体套件,以『 gaim 』为例子:

apt-cache show gaim apt-cache show gaim

我們可以看到gaim 軟體的詳細說明:我们可以看到gaim软体的详细说明:

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

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

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

儘管Debian 的軟體管理機制良好,但是仍舊有盲點存在,由其在於移除軟體部份,現在我們以安裝kaffe 這個package 為例:尽管Debian的软体管理机制良好,但是仍旧有盲点存在,由其在于移除软体部份,现在我们以安装kaffe这个package为例:

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

上列訊息大家應該都十分熟悉了,主要是說明Debian 因為軟體相依性的關係找到要安裝kaffe 必須要加裝libgmp2 這套library,依照一般狀況我們自然是選擇『 Y 』一起安裝囉。上列讯息大家应该都十分熟悉了,主要是说明Debian因为软体相依性的关系找到要安装kaffe必须要加装libgmp2这套library,依照一般状况我们自然是选择『 Y 』一起安装啰。

但是如果我們今天想要反安裝kaffe 時,系統卻不會連帶將當初加裝進來的libgmp2 移除:但是如果我们今天想要反安装kaffe时,系统却不会连带将当初加装进来的libgmp2移除:

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

這 裡我們當然選『 Y 』將kaffe 移除,但是問題是剛剛加裝進來的libgmp2 這套library 卻仍存在系統裡面,但卻沒有其他軟體需要它,上述只是單一個例子,系統用久了軟體裝多了,這種無相依性的library 安靜的躺在系統裡的情況也會越多,用慣Debian 的朋友多少也會跟筆者一樣對系統有些許的潔癖,既然無用何必留著。这里我们当然选『 Y 』将kaffe移除,但是问题是刚刚加装进来的libgmp2这套library却仍存在系统里面,但却没有其他软体需要它,上述只是单一个例子,系统用 久了软体装多了,这种无相依性的library安静的躺在系统里的情况也会越多,用惯Debian的朋友多少也会跟笔者一样对系统有些许的洁癖,既然无用 何必留着。

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

     moto@X20[~]$ deborphan moto@X20[~]$ deborphan 
libgmp2

加一點巧思配合Shell Script ,我們可以簡單的寫個Shell 程式自動移除這些library , 如果想要定時清掃,不妨再配合crontab 機制:加一点巧思配合Shell Script ,我们可以简单的写个Shell程式自动移除这些library ,如果想要定时清扫,不妨再配合crontab机制:

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

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

deborphan | xargs apt-get --assume-yes remove 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. 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 檔) 10.6 ar x package.deb (解开.deb档)

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

$ ar x xterm_4.1.0-16_i386.deb $ ar x xterm_4.1.0-16_i386.deb

可以得到底下幾個檔案:可以得到底下几个档案:

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

10.7 update 系列 10.7 update系列

  • update-alternatives
  • update-catalog
  • update-dlocatedb
  • update-fonts-alias
  • update-fonts-dir
  • update-fonts-scale
  • update-inetd
  • update-modules
  • update-passwd
  • update-rc.d
  • update-vfontcap
  评论这张
 
阅读(318)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017