Wednesday 17 May 2017

Which tar options do I need to install node from binary on linux?

Background

I downloaded binary for linux 64-bit and I was following several tutorials, each with similar options:

tar -C /usr/local --strip-components 1 -xzf /path/to/node.tar.gz

I always get this error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I've googled and it seems I have manually specified gzip file format via one of these switches. File is actually tar.xz, not tar.gz. It was probably tar.gz in older versions.

I wonder what do all of these options mean and which one's I need? Is there an auto-detect format option?

This is what running info tar said:

 -C, --directory DIR
       change to directory DIR

 --strip-components=NUMBER
       strip NUMBER leading components from file names on extraction

 -x, --extract, --get
       extract files from an archive

 -z, --gzip, --gunzip --ungzip

 -f, --file ARCHIVE
       use archive file or device ARCHIVE

Questions

I don't understand options -f, --strip-components.

-f - What else can it be but a file? What is "device archive"?

--strip-components - What does --strip-components 1 exactly do here? I don't see any numbers in the file. Please provide example of filename which would be affected by --strip-components and explain how.

And what's the idea with installing nodejs on linux? Just unzip to /usr/local or what else needs to be done?



via Marko Avlijaš

No comments:

Post a Comment