Ubuntu – List all binaries a package provides

aptcommand linepackage-managementtext processing

This is not a duplicate of listing all files a package provides, i want to list all binaries a certain package provides that are in the standard location for binaries.

I know this can be done with some text processing tool along with dpkg -L but i am not very good at those. Please suggest something.

Best Answer

You can do:

dpkg -L <package_name> | grep -E '/s?bin/'
  • dpkg -L lists all the files provided by a package

  • grep -E '/s?bin/' searches for files that have /bin/ or /sbin/ in their names

This will show all binaries in the standard locations e.g. /usr/bin/, /bin/, /usr/sbin/, /usr/bin/ or any other location that has /bin/ in the path.

Example:

% dpkg -L login | grep -E '/s?bin/'
/usr/sbin/nologin
/usr/bin/lastlog
/usr/bin/faillog
/usr/bin/newgrp
/bin/su
/bin/login
/usr/bin/sg

Or with sed:

% dpkg -L login | sed -nr '/\/s?bin\// p'
/usr/sbin/nologin
/usr/bin/lastlog
/usr/bin/faillog
/usr/bin/newgrp
/bin/su
/bin/login
/usr/bin/sg

Or with awk:

% dpkg -L login | awk '/\/s?bin\//'
/usr/sbin/nologin
/usr/bin/lastlog
/usr/bin/faillog
/usr/bin/newgrp
/bin/su
/bin/login
/usr/bin/sg
Related Question