• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

apt-file Command Examples in Linux

by admin

apt-file is a command-line utility that allows you to search for files in packages in the Advanced Packaging Tool (APT) package management system. APT is a system used to manage software packages in Debian and other Linux distributions.

The apt-file command is useful when you need to find out which package includes a specific file, or when you want to list the files that are provided by a particular package. This can be helpful when you need to install a package that provides a specific file that you need, or when you want to know what files are included in a package that you are considering installing.

To use apt-file, you will need to first update the package index with the command apt-file update, which downloads the package index files from the package repositories. Then you can use the apt-file search command to search for a specific file, or the apt-file list command to list the files provided by a particular package.

For example, to search for the file /usr/bin/ls, you would use the command:

# apt-file search /usr/bin/ls

This would display a list of packages that include the file /usr/bin/ls. To list the files provided by the package coreutils, you would use the command:

# apt-file list coreutils

This would display a list of all the files provided by the coreutils package.

apt-file is a useful tool for finding out which package provides a specific file or for listing the files provided by a package. It is especially useful when you are working with a minimal installation of a Linux distribution and need to find out which package to install to get a specific file or set of files.

apt-file Command Examples

1. Update the metadata database:

# apt update

2. Search for packages that contain the specified file or path:

# apt-file {{search|find}} {{partial_path/to/file}}

3. List the contents of a specific package:

# apt-file {{show|list}} {{package_name}}

4. Search for packages that match the regular_expression:

# apt-file {{search|find}} --regexp {{regular_expression}}

Filed Under: Linux

Some more articles you might also be interested in …

  1. How to Debug systemd boot process in CentOS/RHEL 7 and 8
  2. i3status Command Examples in Linux
  3. How to check failed or bad login attempts in Linux
  4. mailq Command Examples in Linux
  5. kdocker Command Examples in Linux
  6. ldd: command not found
  7. Linux OS Service ‘syslog’
  8. setpci command – configure PCI device
  9. killall Command Examples in Linux
  10. quota Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright