Are you using tar -C

Reply to this note

Please Login to reply.

Discussion

Should I?

What if the thing inside the tarball is actually in a subdirectory?

You can selectively choose which files you want to extract if that's the issue. -C is just for where to target the output.

Good example of this is the instructions for installing Go, which targets /usr/local

tar -C /usr/local -xzf go...tar.gz

Conversely, archives like Bitcoin core are generally extracted to current working directory and then files are moved copied from ./bitcoin-{version}/bin to /usr/local/bin

If you want to extract a single file from a tarball that is also nested in subdirectories but you don't want to create those subdirectories, use --strip-components

So with a downloaded bitcoin-24.0.1...tar.gz, I can do this to selectively extract just the bitcoin-cli to the local bin

tar -zxvf bitcoin-24.0.1*.tar.gz bitcoin-24.0.1/bin/bitcoin-cli --strip-components=2 -C /usr/local/bin

I feel there is a lot of wisdom here.