Skip to main content
added 47 characters in body
Source Link
muru
  • 77.9k
  • 16
  • 212
  • 318

When reading the manual of tar command I encountered something wrong with the option --strip-components--strip-components. The example in the manual is that there is a tar file containing a directory with 3 files. When listed with the tar command it looks like this:

$tar -tf music.tar
practice/
practice/blues
practice/folk
practice/jazz

$tar -tf music.tar
practice/
practice/blues
practice/folk
practice/jazz

The manual saysThe manual says the --strip-components option
 allow you to strip away a certain number of leading directory components
and
$ tar --extract --file=music.tar --strip-components=1 folk
will extract the file ‘folk’ into the current working directory.components
Butoption

allow you to strip away a certain number of leading directory components

and

tar --extract --file=music.tar --strip-components=1 folk

will extract the file ‘folk’ into the current working directory.

But when I run this command on Ubuntu, I got this error
 

tar: folk: Not found in archive
tar: Exiting with failure status due to previous errors

tar: folk: Not found in archive
tar: Exiting with failure status due to previous errors

And my tar version is 1.34.
  Besides, I got file folk extracted successfully when I executed the command below
$ tar --extract --file=music.tar --strip-components=1 practice/folk
Did

tar --extract --file=music.tar --strip-components=1 practice/folk

Did I have some misunderstanding about the manual and option --strip-components--strip-components? Or is there something wrong with the manual?

When reading the manual of tar command I encountered something wrong with the option --strip-components. The example in the manual is that there is a tar file containing a directory with 3 files. When listed with the tar command it looks like this:

$tar -tf music.tar
practice/
practice/blues
practice/folk
practice/jazz

The manual says the --strip-components option
 allow you to strip away a certain number of leading directory components
and
$ tar --extract --file=music.tar --strip-components=1 folk
will extract the file ‘folk’ into the current working directory.
But when I run this command on Ubuntu, I got this error
 

tar: folk: Not found in archive
tar: Exiting with failure status due to previous errors

And my tar version is 1.34.
  Besides, I got file folk extracted successfully when I executed the command below
$ tar --extract --file=music.tar --strip-components=1 practice/folk
Did I have some misunderstanding about the manual and option --strip-components? Or is there something wrong with the manual?

When reading the manual of tar command I encountered something wrong with the option --strip-components. The example in the manual is that there is a tar file containing a directory with 3 files. When listed with the tar command it looks like this:

$tar -tf music.tar
practice/
practice/blues
practice/folk
practice/jazz

The manual says the --strip-components option

allow you to strip away a certain number of leading directory components

and

tar --extract --file=music.tar --strip-components=1 folk

will extract the file ‘folk’ into the current working directory.

But when I run this command on Ubuntu, I got this error

tar: folk: Not found in archive
tar: Exiting with failure status due to previous errors

And my tar version is 1.34. Besides, I got file folk extracted successfully when I executed the command below

tar --extract --file=music.tar --strip-components=1 practice/folk

Did I have some misunderstanding about the manual and option --strip-components? Or is there something wrong with the manual?

Source Link

Error with option --strip-components when running example from manual of tar command

When reading the manual of tar command I encountered something wrong with the option --strip-components. The example in the manual is that there is a tar file containing a directory with 3 files. When listed with the tar command it looks like this:

$tar -tf music.tar
practice/
practice/blues
practice/folk
practice/jazz

The manual says the --strip-components option
allow you to strip away a certain number of leading directory components
and
$ tar --extract --file=music.tar --strip-components=1 folk
will extract the file ‘folk’ into the current working directory.
But when I run this command on Ubuntu, I got this error

tar: folk: Not found in archive
tar: Exiting with failure status due to previous errors

And my tar version is 1.34.
Besides, I got file folk extracted successfully when I executed the command below
$ tar --extract --file=music.tar --strip-components=1 practice/folk
Did I have some misunderstanding about the manual and option --strip-components? Or is there something wrong with the manual?