Install Ubuntu packages searching by the package command
I wanted to run ip
command on my Ubuntu 18.04.
The package was not installed, so tried a package search….
root@nginx$ apt list -a ip
and
root@nginx$ dpkg --list ip
Lists nothing…
The apt-file
utility is a saviour here.
If apt-file
is not yet installed, you can use the apt list -a apt-file
and get it installed.
Now you can find the package we use by the command its known for..
root@nginx$ apt-file update
root@nginx$ apt-file search -regexp '/bin/ip$'
It yields the package name as the ouput.
iproute2: /bin/ip
You can also search the package with another command
apt-file search --regexp '/bin/route'
The result will be like
iproute2: /usr/bin/routef
iproute2: /usr/bin/routel
Now you can install the package by
root@nginx$ apt install iproute2
Check if the package is installed.
root@nginx$ dpkg -l iproute2
which should show something like
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-========================-=================-=================-=====================================================
ii iproute2 4.15.0-2ubuntu1.3 amd64 networking and traffic control tools