Score:0

Listing all packages installing into a specific directory

in flag

How to search for all packages installing files into a specific directory.

E.g. I want to list all packages which are writing files into the /etc/apparmor.d directory.

Score:1
cn flag

For the listing limited to the set of installed packages only:

dpkg -S /etc/apparmor.d/

This is helpful when tracking down which installed package(s) placed a particular file.

Score:0
in flag

First install this package

sudo apt install apt-file

and update the database

sudo apt-file update

Next open a terminal and paste/write the following code into it:

mkdir -p ~/.local/bin
cat << EOF > ~/.local/bin/apt-filesearch
#!/usr/bin/env bash
apt-file search \$1 | cut -f 1 -d ":" | sort -u | tr '\n' ' '
EOF
chmod +x ~/.local/bin/apt-filesearch

This will copy the script apt-filesearch into the ~/.local/bin directory.

Now you search for all packages installing stuff into the e.g. /etc/apparmor.d/ directory:

apt-filesearch /etc/apparmor

This script is also nice if you are searching for libs or header files.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.