'pax' a powerful tool to read and write file archives and copy directory hierarchies

To install pax on ubuntu sudo apt-get install pax the manual is attached with this article.
"pax will read, write, and list the members of an archive file, and will copy directory hierarchies. pax operation is independent of the specific archive format, and supports a wide variety of different archive formats."

Here are few examples from the manual which exhibits the power of pax:

pax -w -f /dev/rst0 .

Copies the contents of the current directory to the device /dev/rst0

pax -v -f filename

Gives the verbose table of contents for an archive stored in filename

mkdir newdir cd olddir pax -rw . newdir

This sequence of commands will copy the entire olddir directory hierarchy to newdir

pax -r -s ',^//*usr//*,,' -f a.pax

Reads the archive a.pax with all files rooted in /usr into the archive extracted relative to the current directory.

pax -rw -i . dest_dir

Can be used to interactively select the files to copy from the current directory to dest_dir

pax -r -pe -U root -G bin -f a.pax

Extract all files from the archive a.pax which are owned by root with group bin and preserve all file permissions.

pax -r -w -v -Y -Z home /backup

Update (and list) only those files in the destination directory /backup which are older (less recent inode change or file modification times) than files with the same name found in the source file tree home

Share this