dpkg-name - Linux
Overview
The dpkg-name
command provides information about installed packages in a Debian-based system. It’s mainly used to fetch metadata associated with packages like their names, versions, and specific file path locations.
Syntax
dpkg-name [options] <package-pattern>
Options/Flags
| Option | Description | Default |
|—|—|—|
| --installed
| Query only installed packages | No |
| --available
| Query only available packages | No |
| --name
| Print the package names | No |
| --version
| Print the package versions | No |
| --file
| Print the full paths of the files installed by the package | No |
| -s|--status
| Print the installation state of the package | No |
| --help
| Show help and usage information | No |
Examples
Get package name:
dpkg-name --name linux-kernel
Get package version:
dpkg-name --version bash
Find file path of an installed package:
dpkg-name --file vim
Check if a package is installed:
dpkg-name --status nmap
Common Issues
- No output: Ensure the
package-pattern
specified is correct. If the package is not installed or available, no output will be generated. - Incorrect path: Ensure the
--file
option is used correctly. The paths may vary depending on the system configuration.
Integration
dpkg-name
can be used in conjunction with other commands:
dpkg -s $(dpkg-name --name package-name)
: Print package details from the database.find $(dpkg-name --file package-name)
: Search for files installed by a specific package.dpkg-query -f '${Package} ${Version}\n' $(dpkg-name --name package-name)
: Fetch detailed package information, including dependencies.
Related Commands
dpkg
: Manage Debian packages.dpkg-query
: Query package information.apt
: Command-line tool for package management.