PDA

View Full Version : [SOLVED] Help on tar command



tonysonney
August 7th, 2009, 03:45 PM
Hi,
I am trying to use the following command

tar -strip-components 2 -dir /home/tt0r/Documents/mydroid/ -xvvzf foo.tar.gz

But I get error message

tar: You may not specify more than one `-Acdtrux' option
Try `tar --help' or `tar --usage' for more information.
What am I doing wrong?
From the man tar I found
-strip-components n
Strip the given number of leading directory components
What does it mean? What is mean t by leading directory components? Does it mean first 'n' number of directories out of n+x directories. Sorry being really stupid.

Thanks in Advance,
Tony

wojox
August 7th, 2009, 03:58 PM
Hi,
I am trying to use the following command

tar -strip-components 2 -dir /home/tt0r/Documents/mydroid/ -xvvzf foo.tar.gz

But I get error message

tar: You may not specify more than one `-Acdtrux' option
Try `tar --help' or `tar --usage' for more information.
What am I doing wrong?
From the man tar I found
-strip-components n
Strip the given number of leading directory components
What does it mean? What is mean t by leading directory components? Does it mean first 'n' number of directories out of n+x directories. Sorry being really stupid.

Thanks in Advance,
Tony

`-Acdtrux' option must be the first argument meaning

tar -xvvzf -strip-components 2 /home/tt0r/Documents/mydroid/foo.tar.gz
I don't know what -dir does.

The Cog
August 7th, 2009, 07:18 PM
I don't know what -dir does.

I am guessing he wanted it to change directory. But to do that, the argument is either -C <directory> or --direcory <directory>.

tonysonney
August 20th, 2009, 11:28 AM
Thanks guys. Yes I wanted it to be extracted to /home/tt0r/Documents/mydroid/ . I will try I let you know how it goes.
Thanks,
Tony

tonysonney
September 10th, 2009, 02:03 PM
`-Acdtrux' option must be the first argument meaning

tar -xvvzf -strip-components 2 /home/tt0r/Documents/mydroid/foo.tar.gz
I don't know what -dir does.

Hi ,
I tried

tar -xvvzf -strip-components 2 /home/tt0r/Documents/mydroid/foo.tar.gz

But I get error

tar: -strip-components: Cannot open: No such file or directory.
Any ideas??:confused:

tonysonney
September 10th, 2009, 02:30 PM
I found what I was doing wrong. I should have used

tar --strip-components 2 --dir /home/tt0r/Documents/mydroid/ -xvvzf foo.tar.gz
istead of
tar -strip-components 2 -dir /home/tt0r/Documents/mydroid/ -xvvzf foo.tar.gz

Any way thank you all for the help --dir is used to specify the path to be extracted.
Cheers,
Tony:)