Red Hat based
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
Red Hat-based package management systems use tools to manage software packages in .rpm format. They are known for their robustness and enterprise-level support. Package management includes handling dependencies, managing software repositories, and maintaining system security and performance. Red Hat-based systems are widely used in enterprise environments for their stability and support.
1 - 🖥️dnf
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the dnf command with important options and switches using examples.
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██████╗ ███╗ ██╗███████╗
# ██╔══██╗████╗ ██║██╔════╝
# ██║ ██║██╔██╗ ██║█████╗
# ██║ ██║██║╚██╗██║██╔══╝
# ██████╔╝██║ ╚████║██║
# ╚═════╝ ╚═╝ ╚═══╝╚═╝
# To install the latest version of a package:
dnf install <package name>
# To search package details for the given string
dnf search <string>
# To find which package provides a binary
dnf provides <path to binary>
# The following are available after installing "dnf-plugins-core"
# Download a package
dnf download <package name>
# install the build dependencies for a SRPM or from a .spec file
dnf builddep <srpm/.spec file>
#==============================##==============================#
# CMD dnf #
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command dnf in a clear format. This allows users to quickly access the needed information for dnf without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for dnf are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2 - 🖥️rpm
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the rpm command with important options and switches using examples.
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██████╗ ██████╗ ███╗ ███╗
# ██╔══██╗██╔══██╗████╗ ████║
# ██████╔╝██████╔╝██╔████╔██║
# ██╔══██╗██╔═══╝ ██║╚██╔╝██║
# ██║ ██║██║ ██║ ╚═╝ ██║
# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝
# To install a package:
rpm -ivh <rpm>
# To remove a package:
rpm -e <package>
# To remove a package, but not its dependencies
rpm -e --nodeps <package>
# To find what package installs a file:
rpm -qf </path/to/file>
# To find what files are installed by a package:
rpm -ql <package>
rpm -qpl <rpm>
# To find what packages require a package or file:
rpm -q --whatrequires <package>
rpm -q --whatrequires <file>
# To list all installed packages:
rpm -qa
# To find a pkg's dependencies
rpm -i --test <package>
# Display checksum against source
rpm -K <package>
# Verify a package
rpm -V <package>
#==============================#
# CMD rpm Packetverwaltung
#==============================##==============================#
rpm -qa --filesbypkg | grep " /var/log/"
# List all rpm packaged files in /var/log by what rpm they belong to.
rpm -qa | grep -e http -e php -e mariadb | xargs rpm -V
# Quickly check the integrity of the "AMP" stack on rpm based systems.
rpm -qa --queryformat "%{NAME} %{INSTALLTIME:date}\n" | grep "Nov 2015"
# In RPM, determine which packages where installed in Nov 2015.
rpm -qf $( which lspci )
# Pass the output of which (showing path to lspci) into rpm -qf, which tells you the pkg.
rpm -qa --last | head
# Show the last 10 packages installed on an RPM based host.
rpm -qa --last | tail
# Show the last 10 packages installed on an RPM based host.
rpm -qa | grep -e http -e php -e mariadb | xargs rpm -V
# Quickly check the integrity of the "AMP" stack on rpm based systems.
rpm --dbpath=/oldserverbackup/var/lib/rpm -q perl-Date-Manip
# Specify an alternate rpm database path using --dbpath.
rpm -q -p -filesbypkg Myfile.rpm
# List content of rpm file
rpmdir="$(grep "^%_topdir" /usr/lib/rpm/macros | sed -e s#"^.*%{getenv:HOME}"#"${HOME}"#g -e s#"^.*%{_usrsrc}"#"/usr/src"#g)";
# Get the correct RPM Build directory
rpm -qa --queryformat "%-47{NAME} %{PACKAGER}\n"
# Generate list of installed RPM names(left align) and their packager in formated columns.
# Check when package was installed/updated -> Though technically it’s not one of the yum tips but rather a RPM one but none the less, it’s pretty useful & comes handy at times. We can check when a package has been installed or when its was last update by running the following command,
rpm -qa –last
# To know when a particular package has been installed, execute the following command,
rpm -q package_name –last
rpm -qa --last | head
# Show the last 10 packages installed on an RPM based host.
# Print the 16 most recent RPM packages installed in newest to oldest order
rpm -qa --last | head -n 16
rpm -qa --queryformat "%10{SIZE} %{NAME}\n" | grep -Ev "(kernel|glibc|perl$|python-libs$|coreutils|hwdata$|glib2|grub2$|yum$|binutils$)" | sort -rn | head -100
# Show the largest #rpm packages on the system, omitting *some* of the critical ones
#Print the 16 most recent RPM packages installed in newest to oldest order
rpm -qa --last | head -n 16
rpm -qa --queryformat '%{INSTALLTIME} %{name}-%{version}-%{release}\n' | sort -k 1,1 -rn | nl | head -16 | awk '{printf("%3d %s %s\n", $1,strftime("%c",$2),$3)}'
rpm -qa --queryformat '%{INSTALLTIME} %{name}-%{version}-%{release}\n' | sort -k 1,1 -rn | nl | head -16 | awk '{printf("%3d %s %s\n", $1,strftime("%c",$2),$3)}'
# Print the 16 most recent RPM packages installed in newest to oldest order
# Display a list of the 16 most recently installed RPM packages with newest first.
1 Wed 12 Sep 2018 15:41:27 BST google-chrome-stable-69.0.3497.92-1
2 Fri 07 Sep 2018 19:00:03 BST qrencode-3.4.4-3.mga5
3 Fri 07 Sep 2018 19:00:03 BST lib64qrencode3-3.4.4-3.mga5
4 Mon 03 Sep 2018 15:40:12 BST lib64mariadb18-10.0.36-1.mga5
5 Tue 24 Jul 2018 09:31:50 BST thunderbird-en_GB-52.9.1-1.mga5
6 Tue 24 Jul 2018 09:31:50 BST rootcerts-java-20180411.00-1.mga5
7 Tue 24 Jul 2018 09:31:50 BST rootcerts-20180411.00-1.mga5
8 Tue 24 Jul 2018 09:31:49 BST thunderbird-52.9.1-1.mga5
9 Tue 24 Jul 2018 09:31:46 BST nss-3.28.6-1.4.mga5
10 Tue 24 Jul 2018 09:31:46 BST lib64nss3-3.28.6-1.4.mga5
11 Tue 24 Jul 2018 09:31:46 BST lib64nspr4-4.19-1.mga5
12 Sat 21 Jul 2018 18:43:41 BST xclip-0.12-7.mga5
13 Fri 13 Jul 2018 10:39:35 BST lib64pathplan4-2.38.0-10.1.mga5
14 Fri 13 Jul 2018 10:39:35 BST lib64gvc6-2.38.0-10.1.mga5
15 Fri 13 Jul 2018 10:39:35 BST lib64cgraph6-2.38.0-10.1.mga5
16 Fri 13 Jul 2018 10:39:35 BST lib64cdt5-2.38.0-10.1.mga5
rpm -qa | sed 's/^\(.*\)-\([^-]\{1,\}\)-\([^-]\{1,\}\)$/\1 \2 \3/' | sort | column -t
# Extract rpm package name, version and release using some fancy sed regex
# This command could seem pretty pointless especially when you can get the same result more easily using the rpm builtin queryformat, like: rpm -qa --qf "%{NAME} %{VERSION} %{RELEASE}.%{ARCH}\n" | sort | column -t but nonetheless I've learned that sometimes it can be quite interesting trying to explore alternative ways to accomplish the same task (as Perl folks like to say: There's more than one way to do it!) Show Sample Output:
# [root@docker ~]# rpm -qa | sed 's/^\(.*\)-\([^-]\{1,\}\)-\([^-]\{1,\}\)$/\1 \2 \3/' | sort | column -t
# acl 2.2.51 14.el7.x86_64
# aic94xx-firmware 30 6.el7.noarch
# alsa-firmware 1.0.28 2.el7.noarch
# alsa-lib 1.1.6 2.el7.x86_64
# alsa-tools-firmware 1.1.0 1.el7.x86_64
# atop 2.3.0 8.el7.x86_64
# audit 2.8.4 4.el7.x86_64
# audit-libs 2.8.4 4.el7.x86_64
# audit-libs-python 2.8.4 4.el7.x86_64
# authconfig 6.2.8 30.el7.x86_64
# basesystem 10.0 7.el7.centos.noarch
# bash 4.2.46 31.el7.x86_64
# bash-completion 2.1 6.el7.noarch
# bc 1.06.95 13.el7.x86_64
# bind-libs 9.9.4 73.el7_6.x86_64
# bind-libs-lite 9.9.4 73.el7_6.x86_64
# bind-license 9.9.4 73.el7_6.noarch
# bind-utils 9.9.4 73.el7_6.x86_64
# binutils 2.27 34.base.el7.x86_64
# [... snip ...]
rpm -ql coreutils | egrep '\.gz' | xargs -L1 zfgrep -A1 'SH NAME' | sort -u
# Find primes w/ PCRE. - PrimeDay
rpm -qa --last | head
# Show the last 10 packages installed on an RPM based host.
#==============================##==============================#
# CMD RPM #
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command rpm in a clear format. This allows users to quickly access the needed information for rpm without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for rpm are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
3 - 🖥️rpm2cpio
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the rpm2cpio command with important options and switches using examples.
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██████╗ ██████╗ ███╗ ███╗██████╗ ██████╗██████╗ ██╗ ██████╗
# ██╔══██╗██╔══██╗████╗ ████║╚════██╗██╔════╝██╔══██╗██║██╔═══██╗
# ██████╔╝██████╔╝██╔████╔██║ █████╔╝██║ ██████╔╝██║██║ ██║
# ██╔══██╗██╔═══╝ ██║╚██╔╝██║██╔═══╝ ██║ ██╔═══╝ ██║██║ ██║
# ██║ ██║██║ ██║ ╚═╝ ██║███████╗╚██████╗██║ ██║╚██████╔╝
# ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝╚══════╝ ╚═════╝╚═╝ ╚═╝ ╚═════╝
# List contents of RPM
rpm2cpio foo.rpm | cpio -vt
# Extract contents of RPM
rpm2cpio foo.rpm | cpio -vid
#==============================##==============================#
# CMD RPM2CPIO #
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command rpm2cpio in a clear format. This allows users to quickly access the needed information for rpm2cpio without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for rpm2cpio are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
4 - 🖥️yum
➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the yum command with important options and switches using examples.
▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁
# ██╗ ██╗██╗ ██╗███╗ ███╗
# ╚██╗ ██╔╝██║ ██║████╗ ████║
# ╚████╔╝ ██║ ██║██╔████╔██║
# ╚██╔╝ ██║ ██║██║╚██╔╝██║
# ██║ ╚██████╔╝██║ ╚═╝ ██║
# ╚═╝ ╚═════╝ ╚═╝ ╚═╝
# To install the latest version of a package:
yum install <package name>
# To perform a local install:
yum localinstall <package name>
# To remove a package:
yum remove <package name>
# To search for a package:
yum search <package name>
# To find what package installs a program:
yum whatprovides </path/to/program>
# To find the dependencies of a package:
yum deplist <package name>
# To find information about a package:
yum info <package name>
# List currently enabled repositories:
yum repolist
# List packages containing a certain keyword:
yum list <package_name_or_word_to_search>
# To download the source RPM for a package:
yumdownloader --source <package name>
# (You have to install yumdownloader first, which is installed by the yum-utils package)
#==============================#
# CMD YUM
#==============================##==============================#
yum install package-with-long-name{,-devel}
# Brace expansion quickly appends the devel pacakge as well to your list.
yum install package-with-long-name{,-devel}
# Brace expansion quickly appends the devel pacakge as well to your list.
yum search python | grep ^python
#Search for available python packages through yum, but only show lines for packages starting with python.
yum search php | grep ^php
# Search for available PHP packages through yum, but only show lines for packages starting with php.
# Some pretty useful YUM tips & tricks
#########################################
# Downgrade a package -> You might have come across this issue or might run into someday, where you have upgraded a package that was not meant to be upgraded or you have upgraded a package with good intentions but its causing you some trouble. With YUM , we have option to downgrade a package to the previous version, just open your terminal & execute the following command,
yum downgrade package_name
# Yum shell -> This yum tip is actually known to pretty few. We can actually start a Yum Shell & use it to manage packages. To start the yum shell, open terminal & type Now shell for yum will be started & we can run all the shell command minus the yum at the beginning. For example ‘search package_name’
yum shell
# Install only security updates -> To actually do this, we need to install a plugin called ‘yum-plugin-security’. We don’t need to install this plugin on RHEL 7, as it’s already part of yum. To install the plugin on RHEL 6 , execute the following command,
yum install yum-plugin-security
# Once plugin has bee installed, we can check the list of errates by executing the following command,
yum updateinfo list available
# To check all available security updates, run
yum updateinfo list security all
yum updateinfo list sec
# To install only the errata updates, run
yum update-minimal –security -y
# To download & apply all the security updates, run
yum update –security -y
# Extensive "cleanup" operations following "sudo yum upgrade"
yum upgrade && for pkg in $(package-cleanup --orphans -q); do repoquery $(rpm -q $pkg --queryformat="%{NAME}") | grep -q ".*" && echo $pkg; done | xargs sudo yum -y remove && for pkg in $(package-cleanup --leaves --all -q); do repoquery --groupmember $pkg | grep -q "@" || echo $pkg; done
# Explanation: "sudo yum upgrade" does clean up outdated packages that the current upgrade replaces, but not other outdated packages or the ones that it willfully skips. Yes, that's what "package-cleanup --orphans" will finish, but "orphaned packages" also include packages that are at their latest version but just aren't updated by the repositories (usually a discrete .rpm installation). This one-liner uses "package-cleanup --orphans" but wraps around it to skip packages that aren't in the repositories anyway and just removes outdated packages that have a newer version in the repositories. No, it's not at the end yet. It has a final command to display all packages that do not belong to any group. Choose any of the "manual extension" packages which aren't really necessary and only clog the system.
# Limitations:
# Specific to only rpm and yum
# No, not just yum, it requires the yum-utils package (or whatever else provides package-cleanup and repoquery, if anything)
#==============================##==============================#
# CMD YUM
#==============================##==============================#
Cheatsheets are an excellent complement to other information sources like Linux man-pages, Linux help, or How-To’s and tutorials, as they provide compact and easily accessible information. While man-pages and detailed tutorials often contain comprehensive explanations and extensive guides, cheatsheets summarize the most important options forthe command yum in a clear format. This allows users to quickly access the needed information for yum without having to sift through lengthy texts. Especially in stressful situations or for recurring tasks, cheatsheets for yum are a valuable resource to work efficiently and purposefully.
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
█║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌
██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗███████╗██████╗
████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
╚██╔═██╔╝██║ ██║██║ ██║ ╚███╔╝ █████╗ ██║ ██║
████████╗██║ ██║██║ ██║ ██╔██╗ ██╔══╝ ██║ ██║
╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
█║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░