0

tar has -C, --directory DIR: change to directory DIR. Does pax have something similar? This can be useful for backing up directory structures/hierarchies in a relative fashion, such as ./sysconfig, instead of /etc/sysconfig, or restoring from inside a directory other than $TARGET_DIR.

I normally use pax in ustar (default) format, or sometimes cpio.

1
  • It might be a newer parameter, but cpio now has a -D parameter. Such as: cpio -D somefolder -i < archive.cpio path/file1 This will extract file1 to ./somefolder/path/file1
    – Brain2000
    Oct 22, 2020 at 5:03

1 Answer 1

0
(cd /etc && pax args) > outputfile

(cd /etc && tar xvz) < inputfile

Equivalent to tar -C.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .