linux命令大全微盘 linux命令大全 pdf( 五 )


安装升级
查看软件xxx安装内容
dpkg -L xxx
查找软件库中的软件
apt-cache search 正则表达式

aptitude search 软件包
显示系统安装包的统计信息
apt-cache stats
显示系统全部可用包的名称
apt-cache pkgnames
显示包的信息
apt-cache show k3b
查找文件属于哪个包
dpkg -S filename
apt-file search filename
查看已经安装了哪些包
dpkg -l
也可用
dpkg -l | less
翻页查看
查询软件xxx依赖哪些包
apt-cache depends xxx
查询软件xxx被哪些包依赖
apt-cache rdepends xxx
增加一个光盘源
sudo apt-cdrom add
系统更新
sudo apt-get update (这一步更新包列表)
sudo apt-get dist-upgrade (这一步安装所有可用更新)
或者
sudo apt-get upgrade (这一步安装应用程序更新,不安装新内核等)
清除所有已删除包的残馀配置文件
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
如果报如下错误,证明你的系统中没有残留配置文件了 , 无须担心 。
----------------------------------------------------------
dpkg: --purge needs at least one package name argument
Type dpkg --help for help about installing and deinstalling packages [*];
Use `dselect' or `aptitude' for user-friendly package management;
Type dpkg -Dhelp for a list of dpkg debug flag values;
Type dpkg --force-help for a list of forcing options;
Type dpkg-deb --help for help about manipulating *.deb files;
Type dpkg --license for copyright license and lack of warranty (GNU GPL) [*].
Options marked [*] produce a lot of output - pipe it through `less' or `more' !
----------------------------------------------------------
编译时缺少h文件的自动处理
sudo auto-apt run ./configure
查看安装软件时下载包的临时存放目录
ls /var/cache/apt/archives
备份当前系统安装的所有包的列表
dpkg --get-selections | grep -v deinstall~/somefile
从上面备份的安装包的列表文件恢复所有包
dpkg --set-selections~/somefile
sudo dselect
清理旧版本的软件缓存
sudo apt-get autoclean
清理所有软件缓存
sudo apt-get clean
删除系统不再使用的孤立软件
sudo apt-get autoremove
如果使用
sudo apt-get autoremove --purge
的话会把这些孤立软件的残留配置文件也一并移除
查看包在服务器上面的地址
apt-get -qq --print-uris download 软件包名称 | cut -d\' -f2
彻底删除Gnome
sudo apt-get --purge remove liborbit2
彻底删除KDE
sudo apt-get --purge remove libqt3-mt libqtcore4
一键安装 LAMP 服务
sudo tasksel install lamp-server
删除旧内核
sudo aptitude purge ~ilinux-image-.*\(\!\(`uname -r`\|generic-.*\)\)
导入ppa源的'key值
#W: GPG签名验证错误:jaunty Release: 由于没有公钥,下列签名无法进行验证: NO_PUBKEY 5126890CDCC7AFE0
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 5126890CDCC7AFE0 #5126890CDCC7AFE0替换为你需要导入的Key值
增加 add-apt-repository 命令
sudo apt-get install software-properties-common
增加一个ppa源
sudo add-apt-repository ppa:user/ppa-name
#使用 ppa 的地址替换 ppa:user/ppa-name
添加163镜像源
sudo add-apt-repository "deb`lsb_release -cs` main restricted universe multiverse"
sudo add-apt-repository "deb`lsb_release -cs`-updates main restricted universe multiverse"
sudo add-apt-repository "deb`lsb_release -cs`-security main restricted universe multiverse"
系统升级
1 这里指的是版本间的升级,例如 9.04=10.04 。
2 使用该升级方式通常需要使用 backports 源 。

推荐阅读