---
title: "'Pax' a Powerful Tool to Read and Write File Archives and Copy Directory Hierarchies"
description: "To install pax on ubuntu sudo apt-get install pax the manual is attached with this article. ’pax will read, write, and list."
url: "https://h3manth.com/scribe/pax-powerful-tool-read-and-write-file-archives-and-copy-directory-hierarchies/"
canonical_url: "https://h3manth.com/scribe/pax-powerful-tool-read-and-write-file-archives-and-copy-directory-hierarchies/"
markdown_url: "https://h3manth.com/scribe/blog/pax-powerful-tool-read-and-write-file-archives-and-copy-directory-hierarchies.md"
publishDate: "2009-10-22T00:00:00.000Z"
author: "Hemanth HM"
category: "linux"
tags: ["ubuntu"]
word_count: 237
reading_time_minutes: 2
x_markdown_tokens: 430
content_signal: "ai-train=yes, search=yes, ai-input=yes"
---

# '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.

**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
