[Linux]Ubuntu与redhat包管理器命令对比

简介:

Below is a table of equivalent commands for package management on both Ubuntu/Debian and Red Hat/Fedora systems.

Task

Red Hat/Fedora

Ubuntu

Adding, Removing and Upgrading Packages

Refresh list of available packages

Yum refreshes each time it's used

apt-get update

Install a package from a repository

yum install package_name

apt-get install package_name

Install a package file

yum install package.rpm 
rpm -i package.rpm

dpkg --install package.deb

Remove a package

rpm -e package_name

apt-get remove package_name

Check for package upgrades

yum check-update

apt-get -s upgrade 
apt-get -s dist-upgrade

Upgrade packages

yum update 
rpm -Uvh [args]

apt-get upgrade

Upgrade the entire system

yum upgrade

apt-get dist-upgrade

Package Information

Get information about an available package

yum search package_name

apt-cache search package_name

Show available packages

yum list available

apt-cache dumpavail

List all installed packages

yum list installed 
rpm -qa

dpkg --list

Get information about a package

yum info package_name

apt-cache show package_name

Get information about an installed package

rpm -qi package_name

dpkg --status package_name

List files in an installed package

rpm -ql package_name

dpkg --listfiles package_name

List documentation files in an installed package

rpm -qd package_name

-

List configuration files in an installed package

rpm -qc package_name

dpkg-query --show -f '${Conffiles}\n'package_name

Show the packages a given package depends on

rpm -qR package_name

apt-cache depends

Show other packages that depend on a 
given package (reverse dependency)

rpm -q -whatrequires [args]

apt-cache rdepends

Package File Information

Get information about a package file

rpm -qpi package.rpm

dpkg --info package.deb

List files in a package file

rpm -qpl package.rpm

dpkg --contents package.deb

List documentation files in a package file

rpm -qpd package.rpm

-

List configuration files in a package file

rpm -qpc package.rpm

-

Extract files in a package

rpm2cpio package.rpm | cpio -vid

dpkg-deb --extract package.deb dir-to-extract-to

Find package that installed a file

rpm -qf filename

dpkg --search filename

Find package that provides a particular file

yum provides filename

apt-file search filename

Misc. Packaging System Tools

Show stats about the package cache

-

apt-cache stats

Verify all installed packages

rpm -Va

debsums

Remove packages from the local cache directory

yum clean packages

apt-get clean

Remove only obsolete packages from the local cache directory

-

apt-get autoclean

Remove header files from the local cache directory 
(forcing a new download of same on next use)

yum clean headers

apt-file purge

General Packaging System Information

Package file extension

*.rpm

*.deb

Repository location configuration

/etc/yum.conf

/etc/apt/sources.list

 

 

 

目录
相关文章
|
15天前
|
Web App开发 Linux 网络安全
工作中常用到的Linux命令
工作中常用到的Linux命令
|
15天前
|
Web App开发 Java Linux
Linux之Shell基本命令篇
Linux之Shell基本命令篇
Linux之Shell基本命令篇
|
2天前
|
机器学习/深度学习 缓存 监控
linux查看CPU、内存、网络、磁盘IO命令
`Linux`系统中,使用`top`命令查看CPU状态,要查看CPU详细信息,可利用`cat /proc/cpuinfo`相关命令。`free`命令用于查看内存使用情况。网络相关命令包括`ifconfig`(查看网卡状态)、`ifdown/ifup`(禁用/启用网卡)、`netstat`(列出网络连接,如`-tuln`组合)以及`nslookup`、`ping`、`telnet`、`traceroute`等。磁盘IO方面,`iostat`(如`-k -p ALL`)显示磁盘IO统计,`iotop`(如`-o -d 1`)则用于查看磁盘IO瓶颈。
|
14天前
|
Linux 网络安全
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
23 1
|
12天前
|
NoSQL Linux Shell
常用的 Linux 命令
常用的 Linux 命令
35 9
|
1天前
|
Ubuntu 网络协议 Linux
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
Linux(20) Ubuntu 20.04 网络接口自动切换路由配置
12 0
|
1天前
|
Linux 数据安全/隐私保护
Linux常用命令实例带注释
Linux常用命令实例带注释
13 0
|
1天前
|
Linux 开发工具 数据安全/隐私保护
Linux(19)常用解压命令记录
Linux(19)常用解压命令记录
6 0
|
1天前
|
Ubuntu Linux Python
Linux(15)Ubuntu安装ninja构建工具
Linux(15)Ubuntu安装ninja构建工具
8 0
|
1天前
|
Ubuntu Linux 数据安全/隐私保护
Linux(7)Ubuntu20.04 arm64安装Docker
Linux(7)Ubuntu20.04 arm64安装Docker
9 0