How To Install gengetopt on CentOS 8

gengetopt is Tool to write command line option parsing code for C programs

Introduction

In this tutorial we learn how to install gengetopt on CentOS 8.

What is gengetopt

Gengetopt is a tool to generate C code to parse the command line arguments argc and argv that are part of every C or C++ program. The generated code uses the C library function getopt_long to perform the actual command line parsing.

We can use yum or dnf to install gengetopt on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install gengetopt.

Install gengetopt on CentOS 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gengetopt using dnf by running the following command:

sudo dnf -y install gengetopt

Install gengetopt on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

The output should look something like this:

CentOS Linux 8 - AppStream                                       43 kB/s | 4.3 kB     00:00    
CentOS Linux 8 - BaseOS                                          65 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - ContinuousRelease                               43 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - Extras                                          23 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - FastTrack                                       40 kB/s | 3.0 kB     00:00    
CentOS Linux 8 - HighAvailability                                36 kB/s | 3.9 kB     00:00    
CentOS Linux 8 - Plus                                            24 kB/s | 1.5 kB     00:00    
CentOS Linux 8 - PowerTools                                      50 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux Modular 8 - x86_64           13 kB/s | 9.2 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                   24 kB/s | 8.5 kB     00:00    
Metadata cache created.

After updating yum database, We can install gengetopt using yum by running the following command:

sudo yum -y install gengetopt

How To Uninstall gengetopt on CentOS 8

To uninstall only the gengetopt package we can use the following command:

sudo dnf remove gengetopt

gengetopt Package Contents on CentOS 8

/usr/bin/gengetopt
/usr/lib/.build-id
/usr/lib/.build-id/65
/usr/lib/.build-id/65/0f6db07a733af6986c317f7ece63b93afd47b4
/usr/share/doc/gengetopt
/usr/share/doc/gengetopt/AUTHORS
/usr/share/doc/gengetopt/ChangeLog
/usr/share/doc/gengetopt/NEWS
/usr/share/doc/gengetopt/README
/usr/share/doc/gengetopt/THANKS
/usr/share/doc/gengetopt/TODO
/usr/share/doc/gengetopt/examples
/usr/share/doc/gengetopt/examples/README.example
/usr/share/doc/gengetopt/examples/main1.cc
/usr/share/doc/gengetopt/examples/main2.c
/usr/share/doc/gengetopt/examples/sample1.ggo
/usr/share/doc/gengetopt/examples/sample2.ggo
/usr/share/doc/gengetopt/gengetopt.html
/usr/share/doc/gengetopt/index.html
/usr/share/gengetopt
/usr/share/gengetopt/getopt.c
/usr/share/gengetopt/getopt1.c
/usr/share/gengetopt/gnugetopt.h
/usr/share/info/gengetopt.info.gz
/usr/share/info/index.info.gz
/usr/share/licenses/gengetopt
/usr/share/licenses/gengetopt/COPYING
/usr/share/licenses/gengetopt/LICENSE
/usr/share/man/man1/gengetopt.1.gz

References

Summary

In this tutorial we learn how to install gengetopt on CentOS 8 using yum and dnf.