Using apt list --installed one can get a list of packages installed by apt-get command. However, I would like to get a list of all packages installed in some other way e.g. by some script. Is this possible to get?

marked as duplicate by N0rbert, karel, Eric Carvalho, Kulfy, Elder Geek Dec 24 '18 at 18:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • If they were installed by a script - the script probably calls the apt tools anyway to install packages (ie. apt, apt-get or dpkg so to the system they are installed the same way. Are you asking about packages installed to meet dependencies? – guiverc Dec 24 '18 at 11:27

Personally I have checked this with the command below.
It recursively finds files in common directories and then calls dpkg --search (see man dpkg) on found file and redirects error output to the file:

sudo find /bin /boot /etc /lib /lib64 /opt /sbin /srv /usr /var -type f \
-exec dpkg -S {} \; 2> ~/not-from-apt.out

Its stdout contains lines with files from APT as shown below

coreutils: /bin/cat

but its stderr (which is redirected to file) contains lines with files not from APT as shown below:

dpkg-query: no path found matching pattern /boot/grub/grub.cfg

Please note that this method is rough. You need to grep the resulting file for executables or customize the list of directories to search.

Not the answer you're looking for? Browse other questions tagged or ask your own question.