Linux tar archive without parent structure

Solution 1:

Disabling recursion in tar.

POSIX pax(1) has -d option which enables cpio-like interface while allowing to create .tar files. Example from Wikipedia:

find . -depth -print | pax -wd > archive.tar

GNU tar(1) has an analogous option, --no-recursion. Example from there:

find dir tests | tar -cf archive -T - --no-recursion

P.S. I usually fall back to cpio(1) in such cases.

Solution 2:

It's a little dirty, but yes:

michael@choad:~$ tar cf - -C ~/scratch packing_slip_411.pdf -C ~/bin/df_linux/ README.linux | tar tvf -
-rw-r--r-- michael/users 37686 2012-03-30 15:09 packing_slip_411.pdf
-rwx------ michael/users  1364 2012-03-30 07:27 README.linux