Softpanorama
(slightly skeptical) Open Source Software Educational Society

May the source be with you, but remember the KISS principle ;-)

Softpanorama Search

The pax Command

News Books See also Recommended Links

Tutorial

Reference  Tips
star gnu tar gzip find tutorial History Humor Etc

pax which stands for portable archive interchange. The pax command provides better portability than the tar or cpio commands for POSIX-compliant systems. Use the pax command to copy files, special files, or file systems that require multiple tape volumes or when you want to copy files to and from POSIX-compliant systems. Disadvantages of the pax command are that it is not aware of file system boundaries and the full path name length cannot exceed 255 characters.

Copying All Files in a Directory to a Tape (pax)

Follow these steps to use the pax command to copy all the files in the current directory to a tape:

1.  Change to the directory that contains the files you want to copy.
2.  Insert a write-enabled tape into the tape drive.
3.  Type pax -w -f < /dev/rmt/ and press Return. The -w option writes the current directory contents to tape. The -f option identifies the tape drive. The pax command does not list the files as they are copied.
4.  Type pax -l -f < /dev/rmt/ and press Return. The -l option lists the files on the tape to verify that the files are copied.
5.  Remove the tape from the drive and write the names of the files on the tape label.

In this example, all files are copied from the tape in drive 0:

castle% pax -w -f /dev/rmt/0 .
castle% pax -l -f /dev/rmt/0
.
./addusr-1.rs
./addusr-2.rs
./at-addmn.rs
./at-base.rs
./at-menu.rs
castle%

See the pax(1) manual page for more information.


NOTE:  When you use the pax command to copy files to a single-volume tape, you can also list and retrieve files from that tape by using the tar command.

 

Retrieving All Files on a Tape (pax)

Follow these steps to use the pax command to copy all the files on a tape into the current directory:

1.  Change to the directory where you want to copy the files.
2.  Insert a write-enabled tape into the tape drive.
3.  Type pax -r -f </dev/rmt/n . and press Return. The -r option reads the contents of the tape to the current directory. The -f option identifies the tape drive. The pax command does not list the files as they are copied.
4.  Type ls -l and press Return. The ls -l command lists the files in the current directory and shows their permissions to verify that the files are copied.
5.  Remove the tape from the drive and write the names of the files on the tape label.

In this example, all files are copied from the tape in drive 0:

% pax -r -f /dev/rmt/0 .
pax: . :not owner
castle% ls -l
-rw-rw-rw-   1 winsor   staff     245660 Sep 12 11:52 addusr-1.rs
-rw-rw-rw-   1 winsor   staff     245660 Sep 12 10:31 addusr-2.rs
-rw-rw-rw-   1 winsor   staff     181315 Sep 12 10:29 at-addmn.rs
-rw-rw-rw-   1 winsor   staff     181309 Sep 12 10:27 at-base.rs
-rw-rw-rw-   1 winsor   staff     181315 Sep 12 10:28 at-menu.rs
castle%


Copyright © 1996-2009 by Dr. Nikolai Bezroukov. www.softpanorama.org was created as a service to the UN Sustainable Development Networking Programme (SDNP) in the author free time. Submit comments This document is an industrial compilation designed and created exclusively for educational use and is placed under the copyright of the Open Content License(OPL). Site uses AdSense so you need to be aware of Google privacy policy. Original materials copyright belong to respective owners. Quotes are made for educational purposes only in compliance with the fair use doctrine.

Disclaimer:

Last modified: August 08, 2009