Extract one file from a remote tar.gz and put it where you want it

tar --strip-components=1 -C ~/bin/ -xzf <( curl -L https://dist.ipfs.tech/kubo/v0.36.0/kubo_v0.36.0_linux-amd64.tar.gz ) kubo/ipfs
This fetches ipfs v0.36.0 for GNU/LInux and puts it in ~/bin without a tmp file or anything else. This works if you already have ~/bin. The `--strip-components=1` flag removes the "kubo" directory in this case. If you have a tar with an even deeper directory structure, say: `some/other/directory/file`, you can just use `--strip-components=3` and it will only extract `file` for you. `-C ~/bin` puts the file in the designated path. In this case, `~/bin`.
Sample Output
$ tar -C ~/bin/ --strip-components=1 -xzf <( curl -L https://dist.ipfs.tech/kubo/v0.36.0/kubo_v0.36.0_linux-amd64.tar.gz ) kubo/ipfs
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 49.0M  100 49.0M    0     0  26.1M      0  0:00:01  0:00:01 --:--:-- 26.1M

2
By: renich
2025-08-12 03:38:07

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: