Below are the list of commands which we use on daily basis for troubleshooting in RHEL 8/9 and SUSE 12/15.
All rpm commands can be used in RHEL 6,RHEL 7, RHEL 8 and RHEL 9 and also we can use it in SUSE 12 and SUSE 15 as well.
|
Command |
Description |
RHEL |
SUSE |
1 |
rpm -qa |
List All installed packages. |
RHEL6/7/8/9 |
SUSE12/15 |
2 |
rpm -qa --last |
List All installed packages sorted
by installation date. |
RHEL6/7/8/9 |
SUSE12/15 |
3 |
rpm -q package_name |
Check if a specific package is
installed. |
RHEL6/7/8/9 |
SUSE12/15 |
4 |
rpm -qi package_name |
Get detailed information about an
installed package. |
RHEL6/7/8/9 |
SUSE12/15 |
5 |
rpm -ql package_name |
shows list of all files installed by
a package. |
RHEL6/7/8/9 |
SUSE12/15 |
6 |
rpm -qf /path/to/file |
Find which package owns a specific
file. |
RHEL6/7/8/9 |
SUSE12/15 |
7 |
rpm -V package_name |
Verify the integrity of a specific
package (checks for changes or missing files). |
RHEL6/7/8/9 |
SUSE12/15 |
8 |
rpm -qR package_name |
List dependencies of a package. |
RHEL6/7/8/9 |
SUSE12/15 |
9 |
rpm -Va |
Verify all installed packages. |
RHEL6/7/8/9 |
SUSE12/15 |
10 |
rpm --checksig package_file.rpm |
Verify the signature of an RPM file. |
RHEL6/7/8/9 |
SUSE12/15 |
11 |
rpm --setperms package_name |
Resets the file permissions and
ownership of all files in the installed packages to the values defined in the
RPM database. |
RHEL6/7/8/9 |
SUSE12/15 |
12 |
rpm --setugids package_name |
Resets the user and group ownership
of files to the values defined in the RPM package metadata. |
RHEL6/7/8/9 |
SUSE12/15 |
13 |
rpm --restore package_name |
Restores all file attributes,
including permissions, ownership, and SELinux contexts if applicable. |
RHEL6/7/8/9 |
SUSE12/15 |
14 |
rpm --restore --all |
Restores all file attributes,
including permissions, ownership, and SELinux contexts if applicable. |
RHEL6/7/8/9 |
SUSE12/15 |
15 |
rpm --rebuilddb |
Rebuild the RPM database (useful if
it is corrupted). |
RHEL6/7/8/9 |
SUSE12/15 |
16 |
dnf install package_name |
Install a package along with
dependencies |
RHEL 8/9 |
|
17 |
dnf update package_name |
Update a specific package. |
RHEL 8/9 |
|
18 |
dnf remove package_name |
Remove a package. |
RHEL 8/9 |
|
19 |
dnf update |
Update All package or
complete patching |
RHEL 8/9 |
|
20 |
dnf list available |
To check for available software (not
installed) |
RHEL 8/9 |
|
21 |
dnf list installed |
To check for software/package being
already installed |
RHEL 8/9 |
|
22 |
dnf list all |
To check for all software (available
and installed) |
RHEL 8/9 |
|
23 |
dnf list package_name |
Search for packages whether it is
installed or available |
RHEL 8/9 |
|
24 |
dnf search keyword |
Search for a package by name or
description. |
RHEL 8/9 |
|
25 |
dnf -v search keyword |
Detailed search for a package by
name or description. |
RHEL 8/9 |
|
26 |
dnf check-update |
List available updates for all
packages. |
RHEL 8/9 |
|
27 |
dnf list updates |
List available updates for all
packages. |
RHEL 8/9 |
|
28 |
dnf info package_name |
Show detailed information about a
package. |
RHEL 8/9 |
|
29 |
dnf history |
Show transaction history of package
management. |
RHEL 8/9 |
|
30 |
dnf history info transaction_id |
View details of a specific
transaction. |
RHEL 8/9 |
|
31 |
dnf history undo transaction_id |
Undo a specific transaction. |
RHEL 8/9 |
|
32 |
dnf deplist package_name |
Check dependencies for a package. |
RHEL 8/9 |
|
33 |
dnf install package_name
--skip-broken |
Install a package, skipping broken
dependencies. |
RHEL 8/9 |
|
34 |
dnf clean all |
Clear all cached data used by yum |
RHEL 8/9 |
|
35 |
dnf localinstall file.rpm |
Install a local .rpm package with
dependency resolution. |
RHEL 8/9 |
|
36 |
dnf -v install package_name |
Enable verbose output during
installation for debugging purposes. |
RHEL 8/9 |
|
37 |
dnf repolist all |
To list all repositories (including
disabled ones) |
RHEL 8/9 |
|
38 |
dnf repolist |
This will list all enabled
repositories |
RHEL 8/9 |
|
39 |
dnf-config-manager --disable
<repo_id> |
disable the repo for permanent/all
sessions |
RHEL 8/9 |
|
40 |
dnf-config-manager --enable
<repo_id> |
enable the repo for permanent/all
sessions |
RHEL 8/9 |
|
41 |
dnf update --disablerepo
"*" --enablerepo=baseos |
disable all repos and enable only
baseos repo in current session - temporarly only on logged session |
RHEL 8/9 |
|
42 |
dnf update --disablerepo=baseos |
disable only one repo baseos and go
for update with all enabled respos- temporarly only on logged session |
RHEL 8/9 |
|
43 |
dnf update -y --disablerepo='*'
--enablerepo='*microsoft*' |
disable all repos and enable all
respos with *microsoft* |
RHEL 8/9 |
|
44 |
dnf install --downloadonly
--downloaddir packge-download/ nmap |
download only packages in directory |
RHEL 8/9 |
|
45 |
dnf --disablerepo=* localinstall
*.rpm |
disable all repos and local install
from downloaded directory |
RHEL 8/9 |
|
Post a Comment