Make easy, portable archives using pax
pax stands for "portable archive exchange," as it was designed specifically to allow portability between different versions of Unix. There's also a bit of wry humor in the name, as pax attempts to bring some "peace" to the long-standing battle over which is better: tar or cpio. The pax utility can be used to create either type of archive, and during a restore, it automatically detects the type of archive for you. We'll start with some examples of basic pax usage, then move on to some fancier stuff.
To back up the contents of your home directory, invoke write mode using the w switch:
cd pax -wf home.pax .
In this example, I went to my home directory with
cd, then told pax to write
w) to a file (
home.pax the contents of the current directory
.). When you use pax,
it's very important to remember to include that
f switch to indicate the name of the archive
you'd like to create. If you forget the f, weird
characters will be sent to your screen, accompanied by horrible,
pained noises. Also, if you want to watch as pax
does its thing, simply add the v, or verbose,
switch to the switch portion of the command.
To see what type of file you've just created, use the file command:
file home.pax home.pax: POSIX tar archive
To see the contents of that archive, tell pax which archive file you'd like to view, using the f switch:
pax -f home.pax |more
Since my archive file is rather large, I piped ...