🖥️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
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░