Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

When I want to view the following tar file , then tar show the following three files

from /var/tmp

       tar tvf  fix.tar 

       install.sh
       /usr/cti/apps/swp/dir/script1.sh
       /usr/cti/lib/swp/dir/script2.sh

. .

but when I want to open the files to their directories

then I get error about /usr/cti/lib/swp/dir/script2.sh ,

please advice why tar cant open the script2.sh under /usr/cti/lib/swp/dir ?

from /var/tmp

       tar xvfp  fix.tar 
       install.sh
       /usr/cti/apps/swp/dir/script1.sh
       tar: Removing leading `/' from member names
       /usr/cti/lib/swp/dir/script2.sh
share|improve this question
    
You don't say what directory you're in when doing this, but have you tried looking for ./usr/cti/lib/swp/dir/script2.sh (note leading dot)? –  MadHatter Oct 16 '12 at 12:50
    
lead dot ? I dont have ! –  yael Oct 16 '12 at 12:54
    
You misunderstand; . refers to the current working directory. I'm suggesting that, whatever directory you're in when you run the tar xvfp command, you look for usr/cti/lib/swp/dir/script2.sh under that directory. Sorry not to have been clearer. –  MadHatter Oct 16 '12 at 12:55

1 Answer 1

up vote 1 down vote accepted

Try to define an output directory with the -C option. The files will be extracted to the 'root' of the filesystem/harddrive by setting it to /

So to extract your archive you should try the following command:

tar xvfp fix.tar -C /

This way the files script1.sh and script2.sh will be extracted to /usr/cti/apps/swp/dir/

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.