7

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 ?

ChiseledAbs
  • 2,243

1 Answers1

11

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

pouya
  • 126
  • 1
  • 4