1833883 Members
1715 Online
110063 Solutions
New Discussion

tar -xvf

 
Donald Thaler
Super Advisor

tar -xvf

what does the 'x' signify next to each file that is 'untarred'?
15 REPLIES 15
Uday_S_Ankolekar
Honored Contributor

Re: tar -xvf

x: extract file...untar as you said!
Good Luck..
Torsten.
Acclaimed Contributor

Re: tar -xvf

Hi Donald,

"-x" means extract. You may extract, add or view file from/to/in a tar-archive.

Do a "man tar" for more information!

Regards
Torsten

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
James R. Ferguson
Acclaimed Contributor

Re: tar -xvf

Hi Donald:

I believe that you are asking what the "x" means *as* you perform an archive extraction:

As far as I know, it is an informatory message to the effect that you are e(x)traacting as opposed to (a)rchiving:

# tar -cvf /tmp/myarchive /tmp/myfile

a /tmp/myfile 0 blocks

# tar -xvf /tmp/myarchive
x /tmp/myfile, 0 bytes, 0 tape blocks

Regards!

...JRF...
Devender Khatana
Honored Contributor

Re: tar -xvf

Hi,

As stated earlier it display the action it is performing. If the process has more files the screen will scroll very fast and one can not find out actually what it going on screen.

This is how I utilize this.

Best Regards,
Devender
Impossible itself mentions "I m possible"
Donald Thaler
Super Advisor

Re: tar -xvf

i used the following command 'tar -xvf printers.tar', i saw the files that were being extracted flash by on the screen but i can't find where they went. the printers.tar file was in the directory /u06/donald, i had created a subdirectory printers under /u06/donald, and i thought the files should have been extracted to that subdirectory (/u06/donald/printers) but they weren't????
melvyn burnard
Honored Contributor

Re: tar -xvf

was the tar archive created with a relative path or absolute path?

use tar -vtf > toc
then read the toc file to see what files are in the archive, and their path nameing.
If the archive was create dusing absolute paths, i.e. starting with /
they will only extract to the absolute path.
Then you can use pax to extract to a local directory
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Patrick Wallek
Honored Contributor

Re: tar -xvf

Well, how did you create the tar file? Did you use relative pathing or explicit pathing in the tar command.

If you did:

# tar -cvf file.tar /u06/whatever

Then when you extract the files will be extracted to that same exact path.

Now if you did:

# tar -cvf file.tar ./u06/whatever
or
# tar -cvf file.tar u06/whatever
(Note the ./ in the first example and the lack of a leading / in the 2nd)

Then when you exctract the files they will be restored relative to the directory you were in when you did the 'tar -x'.

So if you were in /u06 and then did a 'tar -xvf file.tar' the files would have been restored to /u06/u06/whatever.

So, go look in the directory you were in when you did the 'tar -x' and look for a newly created u06 sub-directory there.
Devender Khatana
Honored Contributor

Re: tar -xvf

Hi,

This happens when you create archive using full path or absolute path. The file are gine to the directory from where they were created either on same or different system.

To avoid this sort of scenario and restore to local directory you should create archive with relative path. Something like this

#tar -cvf test.tar hp*

Once done like this it will be restored to local directory only.

HTH,
Devender
Impossible itself mentions "I m possible"
Raj D.
Honored Contributor

Re: tar -xvf

Hi Donald ,

example:
# tar -tvf /dev/rmt0

t for View.
c for copy from disk to tape.
x for extract to tape.

#man tar

Cheers,
Raj.
" If u think u can , If u think u cannot , - You are always Right . "
Donald Thaler
Super Advisor

Re: tar -xvf

arhived with a relative path their was no '/' in front of any of the files. there is plenty of room on the /u06 device. the tar command i am usin is 'tar -xvf printers.tar', where should the files wind up???
Patrick Wallek
Honored Contributor

Re: tar -xvf

What directory are you in when you do the 'tar -x'?

Whatever directory that is, your stuff will be restored there. The directory structure will be created as the restore is done.
melvyn burnard
Honored Contributor

Re: tar -xvf

well they should then be in a path relative to the directory you are in when extracting the archive.
So if you were in /u06 and the files were stored as ./myfiles they should be in /u06

Which directory were you in, and provide an example of the path/filename of one of the extracted files and it will be easier to point you in the right direction
My house is the bank's, my money the wife's, But my opinions belong to me, not HP!
Arunvijai_4
Honored Contributor

Re: tar -xvf

# man tar says about "x"


x Extract the named file from the archive and restore it to
the system. If a named file matches a directory whose
contents were written to the archive, this directory is
(recursively) extracted. If a named file on tape does not
exist on the system, the file is created as follows:

+ The user, group, and other protections are restored
from the tape.

+ The modification time is restored from the tape
unless the m function modifier is specified.

+ The file user ID and group ID are normally those of
the restoring process.

+ The set-user-ID, set-group-ID, and sticky bits are
not set automatically. The o and p function
modifiers control the restoration of protection; see
below for more details.

If the files exist, their modes are not changed, but the
set-user-id, set-group-id and sticky bits are cleared. If
no file argument is given, the entire content of the archive
is extracted. Note that if several files with the same name
are on the archive, the last one overwrites all earlier
ones.
"A ship in the harbor is safe, but that is not what ships are built for"
Donald Thaler
Super Advisor

Re: tar -xvf

I found them, I incorrectly assumed that the tar -xvf process used the name of the .tar file as the output directory. so i was doing a tar -xvf printers.tar from the /u06/donald direcotry and i was looking for the files in
/u06/donald/printers when in fact the files wound up in /u06/donald.
melvyn burnard
Honored Contributor

Re: tar -xvf

Glad you got it sorted.

Now that you have your answer, it might be worth assigniing points to those who have helped you in the past:

I have assigned points to 42 of 139 responses to my questions.

My house is the bank's, my money the wife's, But my opinions belong to me, not HP!