How does centos find the installation package corresponding to a certain command

demand background

Sometimes a development environment is built in a container, and some commands are required to be used in the container, but sometimes only the command is known, but the installation package corresponding to the command is not known. For example, the simplest command ip command, "ip a" can view all the ip information of the host. This is a frequently used command, but I don't know which package provides it, and it will take some time to install it in the container. Of course, you can also copy the bin file of the host to the container. , and then add it to the environment variable of the container, it can be used, but this is not what I will introduce today

Solution

Method 1: man command

The man command is more general and not limited to the centos system, it should be possible on Linux

The man command jumps out of the help document of the command, and there will be a corresponding software package at the end of the document

Example 1: Such as man ip, then jump to the end of the document (press ctl+G)

This iproute2 is the corresponding software package, and then it can be installed through yum install iproute2

Example 2: Such as man netstat, then jump to the end of the document (press ctl+G)

Method 2: yum provides

Use the help command of the system software package management tool, such as yum -h, check the help information, and find that the yum provides command also provides the function of searching software packages through commands (other ubuntu uses apt)

Guess you like

Origin blog.csdn.net/u011285281/article/details/132363279