Forrest logo
back to the apt-file tool

apt-file:tldr:14137

apt-file: Search for packages that contain the specified file or path.
$ apt-file ${select} ${partial_filename}
try on your machine

The apt-file command is used in Linux systems to search for files provided by packages that are not currently installed on the system. It is used to find which package provides a specific file.

The command has the following structure: apt-file ${select} ${partial_filename}

  • ${select}: This is a placeholder for an option that specifies how the search should be performed. It could be one of the following options:

    • -l: Lists all the packages that contain the file specified by ${partial_filename}.
    • -x: Prints the full path of the file specified by ${partial_filename} if it belongs to a package that is installed on the system.
  • ${partial_filename}: This is a placeholder for the partial name of the file you are searching for. It can be a portion of the file name or even a full file name.

Once the command is executed, it will search the package index maintained by the package manager and display the results based on the selected option.

For example, if you want to know which packages provide files similar to "readme.txt", you can use the following command: apt-file -l readme.txt. It will list all the packages that contain files with names similar to "readme.txt".

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the apt-file tool