✓ Solved

How do I see where a package gets installed

I would like to see where a package gets installed as the stdout prints to screen.

I have read on the Linux file system. I have searched askubuntu and followed advise there. This question comes about currently because when I try to install Swift on linux and try to open the repl there is an error reads the file can not be found. I need to know where this package went so I can adjust the env path and I am not finding the install location in the stdout nor the logs and it does not really matter if the files installed to expected locations as I do not wish to use the find command nor search these location as I will be interested in the install locations every time I install anything. This seems to be a reoccuring endeavor I make frequently for many reasons, accessing file install locations.

How do I get the install location printed in the stdout or what is the best way to go about this?

I tried to search this community for:
How do I see where a package gets installed
package install location
where package installs

These all return similar results with nothing on target. Is there anything I can do to refine this search. Can anyone tell me the best way to search this community.

3 Replies

✓ Best Answer

In your OP, you write:

This question comes about currently because when I try to install Swift on linux and try to open the repl there is an error reads the file can not be found.

You also write:

I would really like to see the install location spelled out in the stdout.

dpkg --contents some-pkg writes to stdout. I'm not seeing/understanding your objection here.

The apt* utilities are wrappers of one sort or another around dpkg so, if your purpose is to just locate an installed file, this is the definitive list of file installation locations for a particular package.

To find out which package provides a particular file, see:

https://www.linuxuprising.com/2018/11/how-to-find-package-that-provides-file.html

apt-file also writes it's results to stdout.

Also,

apt install some-pkg --verbose --dry-run

doesn't give you what you want? This basically says 'show me everything you would do if I actually asked you install some-pkg'. I believe the output shows a list of file paths installed…but I don't have a Debian/Ubuntu system to test this on so you'll have to experiment on your own. This also writes to stdout so you can do:

apt install some-pkg --verbose --dry-run | grep whatever-Im-looking-for

You can always write a script to do exactly what you want. From your perspective as a command user the redirect is buried in the script so you never see it. The script can have all kinds of regex filters, path filters, etc. … the script can be as (un)sophisticated as you care to make it. This is why God invented the shell…

This might be helpful:

https://unix.stackexchange.com/questions/570680/how-can-i-enable-verbose-output-in-apt

Modifying the behavior of the system package installer (no matter how innocuous you may think your mods are) is always risky so the standard warning of

DANGER WILL ROBINSON! DANGER! DANGER!

continues to apply.

-- sw

Since you are using Ubuntu, see:

https://linuxhint.com/find-what-files-are-in-a-package-in-ubuntu/

This goes for Debian (Ubuntu's upstream parent) as well.

apt-get(8) does not have a direct option to change the install directory. dpkg(1) does, but it is intended for a chroot environment…so… DANGER WILL ROBINSON! DANGER! DANGER!

-- sw

stevewi:

Good link and thanks for prompt reply but not quite what I have in mind. I would really like to see the install location spelled out in the stdout.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct