random tips on coding, ops, ...

Linux 系统日常维护命令

软件包(portage/source list)同步

  • Gentoo emerge --synceix-sync

  • Debian apt-get update

  • RHEL/CentOS ``

更新所有安装的软件

  • Gentoo emerge -auvDN world

  • Debian apt-get upgrade

  • RHEL/CentOS yum update

搜索软件

  • Gentoo emerge -s busybox

  • Debian apt-cache search busybox

  • RHEL/CentOS yum search busybox

安装/更新软件

  • Gentoo emerge -av busybox

  • Debian apt-get install busybox

  • RHEL/CentOS rpm -[i|U]vh *.rpmyum [install|update] busybox

删除软件

  • Gentoo emerge -C busybox

  • Debian apt-get remove busyboxapt-get purge busybox

  • RHEL/CentOS rpm -e busyboxyum remove busybox

自动清除不需要的软件

  • Gentoo emerge --depclean

  • Debian apt-get autoremove

  • RHEL/CentOS package-cleanup --leaves

查看软件包安装的文件列表

  • Gentoo equery files busybox

  • Debian dpkg -L busybox

  • RHEL/CentOS rpm -ql bash

查找文件所属的软件包

  • Gentoo equery belongs /etc/sysctl.conf

  • Debian dpkg -S /etc/sysctl.conf

  • RHEL/CentOS rpm -qf /etc/sysctl.conf

列出所有安装的软件包

  • Gentoo equery list \*equery list -i (gentoolkit <0.3)

  • Debian dpkg -l

  • RHEL/CentOS yum list installed

校验软件包

  • Gentoo equery check busybox

  • Debian cd / && md5sum -c /var/lib/dpkg/info/busybox.md5sums

  • RHEL/CentOS rpm -V busybox

查看安装包版本

  • Gentoo equery uses bash

  • Debian dpkg-query -W -f='${Version}' bash

  • RHEL/CentOS rpm -qi bash

查看二进制包内容

  • Debian dpkg -c *.deb

  • RHEL/CentOS rpm -qpl *.rpm


comments powered by Disqus