1

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
  • 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

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/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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