Last active
January 14, 2017 12:44
-
-
Save hxmuller/81b55841d88281ec32e004465c262bd6 to your computer and use it in GitHub Desktop.
determine which Debian package provides an executable binary
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This does not work for packages not installed. '$(which COMMAND)' | |
# may be replaced with any /path/file. Replace COMMAND with binary | |
# of interest. | |
# | |
# dpkg - package manager for Debian | |
# -S Search for a filename from installed packages | |
# which - locate a command | |
# awk - process output of previous command | |
# gsub(r,s,[t]) - global subsitution, every match of regular expression | |
# r in variable t is replaced by string s. If t is omitted, $0 is used. | |
# /:$/ - matches a colon ':' at the end of a string | |
# "" - empty string | |
# $1 - first field | |
# print $1 - writes field 1 to stdout | |
# | |
# sort - sort lines of text files | |
# -u (without -c) output only the first of an equal run | |
dpkg -S $(which COMMAND) | awk '{gsub(/:$/,"",$1); print $1}' | sort -u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment