<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:og="http://ogp.me/ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:schema="http://schema.org/" xmlns:sioc="http://rdfs.org/sioc/ns#" xmlns:sioct="http://rdfs.org/sioc/types#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" version="2.0" xml:base="https://www.linuxjournal.com/tag/pax">
  <channel>
    <title>pax</title>
    <link>https://www.linuxjournal.com/tag/pax</link>
    <description/>
    <language>en</language>
    
    <item>
  <title>Make Peace with pax</title>
  <link>https://www.linuxjournal.com/content/make-peace-pax</link>
  <description>  &lt;div data-history-node-id="1263302" class="layout layout--onecol"&gt;
    &lt;div class="layout__region layout__region--content"&gt;
      
            &lt;div class="field field--name-field-node-image field--type-image field--label-hidden field--item"&gt;  &lt;img src="https://www.linuxjournal.com/sites/default/files/nodeimage/story/Pax_tux.jpg" width="267" height="380" alt="" typeof="foaf:Image" class="img-responsive" /&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-author field--type-ds field--label-hidden field--item"&gt;by &lt;a title="View user profile." href="https://www.linuxjournal.com/users/james-k-lowden" lang="" about="https://www.linuxjournal.com/users/james-k-lowden" typeof="schema:Person" property="schema:name" datatype="" xml:lang=""&gt;James K. Lowden&lt;/a&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-body field--type-text-with-summary field--label-hidden field--item"&gt;&lt;p&gt;
pax is one of the lesser known utilities in a typical Linux
installation. That's too bad, because pax has a very good feature set,
and its command-line options are easy to understand and remember.
pax is an archiver, like tar(1), but it's also a better version of cp(1) in
some ways, not least because you can use pax with SSH to copy sets
of files over a network. Once you learn pax, you may wonder how you
lived without it all these years.
&lt;/p&gt;

&lt;p&gt;
pax has four modes: list, read, write and copy. Reading and writing
are controlled by the &lt;code&gt;-r&lt;/code&gt; and
&lt;code&gt;-w&lt;/code&gt; options, repectively. In combination,
&lt;code&gt;-rw&lt;/code&gt;, pax acts a little bit like &lt;code&gt;cp
-R&lt;/code&gt;. If neither is used, pax lists
the contents of the archive, which may be a file, device or a pipe.
&lt;/p&gt;

&lt;p&gt;
By default, pax operates as a filter: it reads from standard input and
writes to standard output, a feature that turns out to be very useful.
But usually these days, the target is an archive file, the familiar
tarball. Let's start by creating one:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
$ cd /tmp
$ mkdir paxample
$ touch paxample/foo
$ pax -wf paxample.tar paxample
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
The &lt;code&gt;-w&lt;/code&gt; option means write—that
is, create an archive. The &lt;code&gt;-f&lt;/code&gt; option
provides the name of a file to which to write the archive. If desired, pax
can gzip or bzip the file at the same time:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
$ pax -wzf paxample.tar.gz paxample
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
Like most tar implementations, pax, by default, uses the Posix ustar file
format. Because pax was born of a desire to unify archive file
formats, many other formats also are supported, but in practice, they're
seldom used. Likely as not, any .tar.gz file you download from the
Internet actually will be a ustar archive:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
$ pax -wzf paxample.tar.gz paxample
$ file paxample.tar*
paxample.tar:    POSIX tar archive
paxample.tar.gz: gzip compressed data
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
The first thing you nearly always want to know about any archive is
what's in it. Listing the contents is the default action in the
absence of either a &lt;code&gt;-r&lt;/code&gt; or &lt;code&gt;-w&lt;/code&gt;
option:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
$ pax -f paxample.tar
paxample
paxample/foo
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
Note that the archive retains the directory name you specified
on the command line. That comes into play later when you read it.
&lt;/p&gt;

&lt;p&gt;
To read an archive, use &lt;code&gt;-r&lt;/code&gt;:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
$ mkdir t
$ cd t
$ pax -rf ../paxample.tar
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
What did that do? Let's look at the source and target directories:

&lt;/p&gt;&lt;pre&gt;&lt;code&gt;
$ cd /tmp
$ find paxample t # traverse both trees
paxample
paxample/foo
t
t/paxample
t/paxample/foo
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;
When pax read the paxample.tar archive, it created files in the current
directory, t. Because the archive included a directory name, paxample,
that directory was re-created in the output.
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;
Copying Sets of Files&lt;/em&gt;
&lt;/p&gt;&lt;/div&gt;
      
            &lt;div class="field field--name-node-link field--type-ds field--label-hidden field--item"&gt;  &lt;a href="https://www.linuxjournal.com/content/make-peace-pax" hreflang="und"&gt;Go to Full Article&lt;/a&gt;
&lt;/div&gt;
      
    &lt;/div&gt;
  &lt;/div&gt;

</description>
  <pubDate>Mon, 27 Jan 2014 20:36:44 +0000</pubDate>
    <dc:creator>James K. Lowden</dc:creator>
    <guid isPermaLink="false">1263302 at https://www.linuxjournal.com</guid>
    </item>

  </channel>
</rss>
