User ID: mio
Subject: pax Examples
Some examples of the pax(1) command.
List Archive Contents
pax -f archive.tar
New flag(s):
- -f archive — Specify the archive to read from. Omitting this flag will cause pax to read from stdin.
Alternative
pax < archive.tar
Create Archive
pax -wf archive.tar file1.txt file2.txt
New flag(s):
- -w — Write the files to the stdout.
Alternative
pax -w file1.txt file2.txt > archive.tar
Contents
$ pax < archive.tar
file1.txt
file2.txt
Update Archive
pax -waf archive.tar file3.txt file4.txt
New flag(s):
- -a — Append files to the end of the archive.
Contents
$ pax -f archive.tar
file1.txt
file2.txt
file3.txt
file4.txt
Extract Archive
pax -rf archive.tar
New flag(s):
- -r — read files from the stdin.
Alternative
pax -r < archive.tar
Extract Gzip
Since a lot of tar's are compressed using Gzip, it may be useful to decompress the Gzip and extract underlying tar without modifying the original archive.
gzip ‐dc < archive.tar.gz | pax ‐r
Gzip flags:
- ‐d — decompress
- ‐c — write to standard output