Find the answer to your Linux question:
Results 1 to 3 of 3
Hello, I am using the below tar execution, and it works fine. The question is that when I extract, I always get the full path. Is there a way to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    27

    Help With Tar Execution


    Hello,

    I am using the below tar execution, and it works fine. The question is that when I extract, I always get the full path. Is there a way to when extracting, that it only extracts the files and not include the full path to the files?

    tar -cvjf backup/filename.tar.bz2 /home/virtual/domain.com/var/www/html/ > /dev/null 2>&1.

    Example:
    tar -xvjf filename.tar.bz2 -> extracts to html/

    and not,

    /home/virtual/domain.com/var/www/html/

    Thanks JR

  2. #2
    Linux Enthusiast
    Join Date
    Aug 2006
    Location
    Portsmouth, UK
    Posts
    539
    man tar

    You'll be wanting to look at --strip-path or --strip-components depending on the version of tar you're using.
    RHCE #100-015-395
    Please don't PM me with questions as no reply may offend, that's what the forums are for.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    27
    Hello,

    Thank you. That works for me.

    JR

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •