4

I just installed Archlinux and want to install netstat. However using the command pacman -Ss netstat outputs irrelevant package names. A search on internet revealed that netstat is owned by net-tools. Installing net-tools gave me access to netstat.

How should one proceed to find the package name to install with pacman when only the final bash command is known ?

marked as duplicate by don_crissti, Stephen Harris, jasonwryan, G-Man, Jeff Schaller Jul 24 '16 at 2:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

9

The best way that I have found until now is to use the pkgfile command.
You could install it by:

# sudo pacman -S pkgfile

according to the official arch wiki,

pkgfile is a tool for searching files from packages in the official repositories.

(files being the binaries you mentioned as bash commands).

You can also update its database by running:

# pkgfile -u

or you could just enable its systemd timer for it to update automatically:

# systemctl enable pkgfile-update.timer
# systemctl start pkgfile-update.timer

awsome, right ?! :)

Example

# pkgfile netstat
core/net-tools
extra/munin-node

# pkgfile netstat --verbose
core/net-tools 1.60.20160710git-1       /usr/bin/netstat
extra/munin-node 2.0.26-2               /usr/lib/munin/plugins/netstat

Not the answer you're looking for? Browse other questions tagged or ask your own question.