LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar: removing leading '/' from member names (https://www.linuxquestions.org/questions/linux-newbie-8/tar-removing-leading-%27-%27-from-member-names-4175456632/)

Aarif 04-03-2013 12:31 AM

tar: removing leading '/' from member names
 
i am trying to take a tar by command as below.
tar -cvf app-bkp040413.tar /home/user/app

the tar is created with the following warning
tar: removing leading '/' from member names

how can i overcome this.
TIA
Arif

kooru 04-03-2013 01:52 AM

from "man tar"

Code:

-P, --absolute-names
              don't strip leading `/'s from file names


Aarif 04-03-2013 02:10 AM

appreciated. thnx

so do i need to use "P" again while extracting the tar file?

Also found that the size of tar file is different when used with "P" option and otherwise.

kooru 04-03-2013 02:22 AM

Quote:

Originally Posted by Aarif (Post 4924079)
so do i need to use "P" again while extracting the tar file?

yes

chrism01 04-03-2013 08:24 PM

The problem with using -P will be it will restore to the exact same place, overwriting anything already there. You don't always want that, so it defaults to stripping the leading '/' so you can re-locate the files anywhere and maybe just pick out stuff you want or diff the files from the extant ones.

ruario 04-03-2013 08:43 PM

By the way cpio, works this way by default. However common cpio formats odc and newc have file size limitations that make them unsuited for backups on modern systems. However some cpio implementations, such as bsdcpio (part of libarchive) can output in modern formats (e.g. pax) without such limitations.


All times are GMT -5. The time now is 11:46 PM.