wiki.bash-hackers.org/howto/pax
2023-04-14 23:44:41 +12:00

643 lines
38 KiB
Plaintext

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" dir="ltr" class="no-js">
<head><script type="text/javascript" src="/_static/js/bundle-playback.js?v=TPXmWR5s" charset="utf-8"></script>
<script type="text/javascript" src="/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script>
<script type="text/javascript">
__wm.init("http://web.archive.org/web");
__wm.wombat("https://wiki.bash-hackers.org/howto/pax?do=edit","20221007145722","http://web.archive.org/","web","/_static/",
"1665154642");
</script>
<link rel="stylesheet" type="text/css" href="/_static/css/banner-styles.css?v=S1zqJCYt" />
<link rel="stylesheet" type="text/css" href="/_static/css/iconochive.css?v=qtvMKcIJ" />
<!-- End Wayback Rewrite JS Include -->
<meta charset="UTF-8"/>
<title>pax - the POSIX archiver [Bash Hackers Wiki]</title>
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<link rel="shortcut icon" href="/web/20221007145722im_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/favicon.ico"/>
<link rel="apple-touch-icon" href="/web/20221007145722im_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/apple-touch-icon.png"/>
<meta name="generator" content="DokuWiki"/>
<meta name="robots" content="noindex,nofollow"/>
<link type="text/css" rel="stylesheet" href="/web/20221007145722cs_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/bootstrap/default/bootstrap.min.css"/>
<link rel="search" type="application/opensearchdescription+xml" href="/web/20221007145722/https://wiki.bash-hackers.org/lib/exe/opensearch.php" title="Bash Hackers Wiki"/>
<link rel="start" href="/"/>
<link rel="contents" href="/howto/pax?do=index" title="Sitemap"/>
<link rel="manifest" href="/web/20221007145722/https://wiki.bash-hackers.org/lib/exe/manifest.php"/>
<link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/web/20221007145722/https://wiki.bash-hackers.org/feed.php"/>
<link rel="alternate" type="application/rss+xml" title="Current namespace" href="/web/20221007145722/https://wiki.bash-hackers.org/feed.php?mode=list&amp;ns=howto"/>
<link rel="alternate" type="text/html" title="Plain HTML" href="/web/20221007145722/https://wiki.bash-hackers.org/_export/xhtml/howto/pax"/>
<link rel="alternate" type="text/plain" title="Wiki Markup" href="/web/20221007145722/https://wiki.bash-hackers.org/_export/raw/howto/pax"/>
<link rel="stylesheet" type="text/css" href="/web/20221007145722cs_/https://wiki.bash-hackers.org/lib/exe/css.php?t=bootstrap3&amp;tseed=54923c3deda180f2db5bd755cd8fbf1a"/>
<!--[if gte IE 9]><!-->
<script type="text/javascript">/*<![CDATA[*/var NS='howto';var JSINFO = {"updatable":1,"userreplace":1,"default_macro_string":"","plugins":{"edittable":{"default columnwidth":""}},"move_renameokay":false,"isadmin":0,"isauth":0,"bootstrap3":{"mode":"source","toc":[],"config":{"collapsibleSections":0,"fixedTopNavbar":1,"showSemanticPopup":0,"sidebarOnNavbar":0,"tagsOnTop":1,"tocAffix":1,"tocCollapseOnScroll":1,"tocCollapsed":0,"tocLayout":"default","useAnchorJS":1,"useAlternativeToolbarIcons":1}},"id":"howto:pax","namespace":"howto","ACT":"source","useHeadingNavigation":1,"useHeadingContent":1};
/*!]]>*/</script>
<script type="text/javascript" charset="utf-8" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/exe/jquery.php?tseed=23f888679b4f1dc26eef34902aca964f"></script>
<script type="text/javascript" charset="utf-8" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/exe/js.php?t=bootstrap3&amp;tseed=54923c3deda180f2db5bd755cd8fbf1a"></script>
<script type="text/javascript">/*<![CDATA[*/if (typeof IconifyConfig == 'undefined') { var IconifyConfig = { 'defaultAPI' : '/lib/tpl/bootstrap3/iconify.php?prefix={prefix}&icons={icons}' } }
/*!]]>*/</script>
<script type="text/javascript" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/anchorjs/anchor.min.js"></script>
<script type="text/javascript" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/typeahead/bootstrap3-typeahead.min.js"></script>
<script type="text/javascript" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/iconify/iconify.min.js"></script>
<script type="text/javascript" src="/web/20221007145722js_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/assets/iconify/plugins/fa.js"></script>
<!--<![endif]-->
<style type="text/css">@media screen { body { margin-top: 65px; } #dw__toc.affix { top: 55px; position: fixed !important; } #dw__toc .nav .nav .nav { display: none; } }</style>
<!--[if lt IE 9]>
<script type="text/javascript" src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script type="text/javascript" src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="default dokuwiki mode_source tpl_bootstrap3 dw-page-on-panel dw-fluid-container" data-page-id="howto:pax"><div class="dokuwiki">
<header id="dokuwiki__header" class="dw-container dokuwiki container-fluid mx-5">
<!-- navbar -->
<nav id="dw__navbar" class="navbar navbar-fixed-top navbar-default" role="navigation">
<div class="dw-container container-fluid mx-5">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand d-flex align-items-center" href="/web/20221007145722/https://wiki.bash-hackers.org/start" accesskey="h" title="Bash Hackers Wiki"><img id="dw__logo" class="pull-left h-100 mr-4" alt="Bash Hackers Wiki" src="/web/20221007145722im_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/logo.png"/><div class="pull-right"><div id="dw__title">Bash Hackers Wiki</div></div></a>
</div>
<div class="collapse navbar-collapse">
<div class="navbar-right" id="dw__navbar_items">
<!-- navbar-searchform -->
<form action="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax" accept-charset="utf-8" class="navbar-form navbar-left search" id="dw__search" method="get" role="search">
<div class="input-group">
<input id="qsearch" autocomplete="off" type="search" placeholder="Search" value="" accesskey="f" name="q" class="form-control" title="[F]"/>
<div class="input-group-btn">
<button class="btn btn-default" type="submit" title="Search">
<span class="iconify" data-icon="mdi:magnify"></span> </button>
</div>
</div>
<input type="hidden" name="do" value="search"/>
</form>
<!-- /navbar-searchform -->
<!-- tools-menu -->
<ul class="nav navbar-nav dw-action-icon" id="dw__tools">
<li class="dropdown">
<a href="" class="dropdown-toggle" data-target="#" data-toggle="dropdown" title="" role="button" aria-haspopup="true" aria-expanded="false">
<span class="iconify" data-icon="mdi:wrench"></span> <span class="hidden-lg hidden-md hidden-sm">Tools</span> <span class="caret"></span>
</a>
<ul class="dropdown-menu tools" role="menu">
<li class="dropdown-header">
<span class="iconify" data-icon="mdi:account"></span> User Tools </li>
<li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=register" title="Register" rel="nofollow" class="menuitem register"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M15 14c-2.67 0-8 1.33-8 4v2h16v-2c0-2.67-5.33-4-8-4m-9-4V7H4v3H1v2h3v3h2v-3h3v-2m6 2a4 4 0 0 0 4-4 4 4 0 0 0-4-4 4 4 0 0 0-4 4 4 4 0 0 0 4 4z"/></svg><span>Register</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=login&amp;sectok=" title="Log In" rel="nofollow" class="menuitem login"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M10 17.25V14H3v-4h7V6.75L15.25 12 10 17.25M8 2h9a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-4h2v4h9V4H8v4H6V4a2 2 0 0 1 2-2z"/></svg><span>Log In</span></a></li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">
<span class="iconify" data-icon="mdi:toolbox"></span> Site Tools </li>
<li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=recent" title="Recent Changes [r]" rel="nofollow" accesskey="r" class="menuitem recent"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M15 13h1.5v2.82l2.44 1.41-.75 1.3L15 16.69V13m4-5H5v11h4.67c-.43-.91-.67-1.93-.67-3a7 7 0 0 1 7-7c1.07 0 2.09.24 3 .67V8M5 21a2 2 0 0 1-2-2V5c0-1.11.89-2 2-2h1V1h2v2h8V1h2v2h1a2 2 0 0 1 2 2v6.1c1.24 1.26 2 2.99 2 4.9a7 7 0 0 1-7 7c-1.91 0-3.64-.76-4.9-2H5m11-9.85A4.85 4.85 0 0 0 11.15 16c0 2.68 2.17 4.85 4.85 4.85A4.85 4.85 0 0 0 20.85 16c0-2.68-2.17-4.85-4.85-4.85z"/></svg><span>Recent Changes</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=media&amp;ns=howto" title="Media Manager" rel="nofollow" class="menuitem media"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M7 15l4.5-6 3.5 4.5 2.5-3L21 15m1-11h-8l-2-2H6a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2M2 6H0v14a2 2 0 0 0 2 2h18v-2H2V6z"/></svg><span>Media Manager</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=index" title="Sitemap [x]" rel="nofollow" accesskey="x" class="menuitem index"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M3 3h6v4H3V3m12 7h6v4h-6v-4m0 7h6v4h-6v-4m-2-4H7v5h6v2H5V9h2v2h6v2z"/></svg><span>Sitemap</span></a></li>
<li class="divider" role="separator"></li>
<li class="dropdown-header">
<span class="iconify" data-icon="mdi:file-document-outline"></span> Page Tools </li>
<li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=" title="Show page [v]" rel="nofollow" accesskey="v" class="menuitem show"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m9 16v-2H6v2h9m3-4v-2H6v2h12z"/></svg><span>Show page</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=revisions" title="Old revisions [o]" rel="nofollow" accesskey="o" class="menuitem revs"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M11 7v5.11l4.71 2.79.79-1.28-4-2.37V7m0-5C8.97 2 5.91 3.92 4.27 6.77L2 4.5V11h6.5L5.75 8.25C6.96 5.73 9.5 4 12.5 4a7.5 7.5 0 0 1 7.5 7.5 7.5 7.5 0 0 1-7.5 7.5c-3.27 0-6.03-2.09-7.06-5h-2.1c1.1 4.03 4.77 7 9.16 7 5.24 0 9.5-4.25 9.5-9.5A9.5 9.5 0 0 0 12.5 2z"/></svg><span>Old revisions</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=backlink" title="Backlinks" rel="nofollow" class="menuitem backlink"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M10.59 13.41c.41.39.41 1.03 0 1.42-.39.39-1.03.39-1.42 0a5.003 5.003 0 0 1 0-7.07l3.54-3.54a5.003 5.003 0 0 1 7.07 0 5.003 5.003 0 0 1 0 7.07l-1.49 1.49c.01-.82-.12-1.64-.4-2.42l.47-.48a2.982 2.982 0 0 0 0-4.24 2.982 2.982 0 0 0-4.24 0l-3.53 3.53a2.982 2.982 0 0 0 0 4.24m2.82-4.24c.39-.39 1.03-.39 1.42 0a5.003 5.003 0 0 1 0 7.07l-3.54 3.54a5.003 5.003 0 0 1-7.07 0 5.003 5.003 0 0 1 0-7.07l1.49-1.49c-.01.82.12 1.64.4 2.43l-.47.47a2.982 2.982 0 0 0 0 4.24 2.982 2.982 0 0 0 4.24 0l3.53-3.53a2.982 2.982 0 0 0 0-4.24.973.973 0 0 1 0-1.42z"/></svg><span>Backlinks</span></a></li><li class="action"><a href="#dokuwiki__top" title="Back to top [t]" rel="nofollow" accesskey="t" class="menuitem top"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg><span>Back to top</span></a></li>
</ul>
</li>
</ul>
<!-- /tools-menu -->
<ul class="nav navbar-nav">
<li>
<span class="dw__actions dw-action-icon">
<a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=register" title="Register" rel="nofollow" class="menuitem register btn btn-success navbar-btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M15 14c-2.67 0-8 1.33-8 4v2h16v-2c0-2.67-5.33-4-8-4m-9-4V7H4v3H1v2h3v3h2v-3h3v-2m6 2a4 4 0 0 0 4-4 4 4 0 0 0-4-4 4 4 0 0 0-4 4 4 4 0 0 0 4 4z"/></svg><span class=""> Register</span></a><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=login&amp;sectok=" title="Log In" rel="nofollow" class="menuitem login btn btn-default navbar-btn"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M10 17.25V14H3v-4h7V6.75L15.25 12 10 17.25M8 2h9a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2v-4h2v4h9V4H8v4H6V4a2 2 0 0 1 2-2z"/></svg><span class=""> Log In</span></a> </span>
</li>
</ul>
</div>
</div>
</div>
</nav>
<!-- navbar -->
<div align="center">
<script async src="//web.archive.org/web/20221007145722js_/https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- BHORG_BOTTOM -->
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-4658830517838678" data-ad-slot="1603598940"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</header>
<a name="dokuwiki__top" id="dokuwiki__top"></a>
<main role="main" class="dw-container pb-5 dokuwiki container-fluid mx-5">
<div id="dokuwiki__pageheader">
<!-- breadcrumbs -->
<nav id="dw__breadcrumbs" class="small">
<hr/>
<div class="dw__youarehere">
<ol class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li>You are here</li><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a href="/web/20221007145722/https://wiki.bash-hackers.org/start" itemprop="item" title="start"><span itemprop="name"><span class="iconify" data-icon="mdi:home"></span></span></a></li><li itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a itemprop="item" href="/web/20221007145722/https://wiki.bash-hackers.org/howto/start" class="wikilink1" title="howto:start">HOWTO</a></li><li class="active" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><span itemprop="name"><a itemprop="item" href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax" class="wikilink1" title="howto:pax">pax - the POSIX archiver</a></span></li></ol> </div>
<div class="dw__breadcrumbs hidden-print">
<ol class="breadcrumb"><li>Trace</li> </div>
<hr/>
</nav>
<!-- /breadcrumbs -->
<p class="text-right">
<span class="pageId ml-1 label label-primary">howto:pax</span> </p>
<div id="dw__msgarea" class="small">
</div>
</div>
<div class="row">
<article id="dokuwiki__content" class="col-sm-12 col-md-12 " itemscope itemtype="http://schema.org/Article" itemref="dw__license">
<!-- page-tools -->
<nav id="dw__pagetools" class="hidden-print">
<div class="tools panel panel-default">
<ul class="nav nav-stacked nav-pills text-muted">
<li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=" title="Show page [v]" rel="nofollow" accesskey="v" class="menuitem show"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M13 9h5.5L13 3.5V9M6 2h8l6 6v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4c0-1.11.89-2 2-2m9 16v-2H6v2h9m3-4v-2H6v2h12z"/></svg><span>Show page</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=revisions" title="Old revisions [o]" rel="nofollow" accesskey="o" class="menuitem revs"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M11 7v5.11l4.71 2.79.79-1.28-4-2.37V7m0-5C8.97 2 5.91 3.92 4.27 6.77L2 4.5V11h6.5L5.75 8.25C6.96 5.73 9.5 4 12.5 4a7.5 7.5 0 0 1 7.5 7.5 7.5 7.5 0 0 1-7.5 7.5c-3.27 0-6.03-2.09-7.06-5h-2.1c1.1 4.03 4.77 7 9.16 7 5.24 0 9.5-4.25 9.5-9.5A9.5 9.5 0 0 0 12.5 2z"/></svg><span>Old revisions</span></a></li><li class="action"><a href="/web/20221007145722/https://wiki.bash-hackers.org/howto/pax?do=backlink" title="Backlinks" rel="nofollow" class="menuitem backlink"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M10.59 13.41c.41.39.41 1.03 0 1.42-.39.39-1.03.39-1.42 0a5.003 5.003 0 0 1 0-7.07l3.54-3.54a5.003 5.003 0 0 1 7.07 0 5.003 5.003 0 0 1 0 7.07l-1.49 1.49c.01-.82-.12-1.64-.4-2.42l.47-.48a2.982 2.982 0 0 0 0-4.24 2.982 2.982 0 0 0-4.24 0l-3.53 3.53a2.982 2.982 0 0 0 0 4.24m2.82-4.24c.39-.39 1.03-.39 1.42 0a5.003 5.003 0 0 1 0 7.07l-3.54 3.54a5.003 5.003 0 0 1-7.07 0 5.003 5.003 0 0 1 0-7.07l1.49-1.49c-.01.82.12 1.64.4 2.43l-.47.47a2.982 2.982 0 0 0 0 4.24 2.982 2.982 0 0 0 4.24 0l3.53-3.53a2.982 2.982 0 0 0 0-4.24.973.973 0 0 1 0-1.42z"/></svg><span>Backlinks</span></a></li><li class="action"><a href="#dokuwiki__top" title="Back to top [t]" rel="nofollow" accesskey="t" class="menuitem top"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewbox="0 0 24 24"><path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"/></svg><span>Back to top</span></a></li> </ul>
</div>
</nav>
<!-- /page-tools -->
<div class="panel panel-default px-3 py-2" itemprop="articleBody">
<div class="page panel-body">
<div class="dw-content-page "><!-- content --><div class="dw-content"><p>
This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong.
</p>
<div class="editBox" role="application">
<div class="toolbar group">
<div id="draft__status" class="draft__status"></div>
<div id="tool__bar" class="tool__bar"></div>
</div>
<form id="dw__editform" method="post" action="" accept-charset="utf-8" class=" form-inline"><div class="no">
<input type="hidden" name="sectok" value=""/><input type="hidden" name="id" value="howto:pax"/><input type="hidden" name="rev" value="0"/><input type="hidden" name="date" value="0"/><input type="hidden" name="prefix" value="."/><input type="hidden" name="suffix" value=""/><input type="hidden" name="changecheck" value="4488fa867098a5e4ddaba9e39fc53a44"/><input type="hidden" name="target" value="section"/><textarea name="wikitext" id="wiki__text" dir="auto" class="edit form-control" cols="80" rows="10" tabindex="1" readonly="readonly">
====== pax - the POSIX archiver ======
{{keywords&gt;bash shell scripting POSIX archive tar packing zip}}
pax can do a lot of fancy stuff, feel free to contribute more awesome pax tricks!
===== Introduction =====
The POSIX archiver, ''pax'', is an attempt at a standardized archiver with
the best features of ''tar'' and ''cpio'', able to handle all common archive types.
However, this is **not a manpage**, it will **not** list all possible options,
it will **not** you detailed information about ''pax''. It's only an introduction.
This article is based on the debianized Berkeley implementation of ''pax'', but implementation-specific things should be tagged as such. Unfortunately, the Debian package doesn't seem to be maintained anymore.
===== Overview =====
==== Operation modes ====
There are four basic operation modes to //list//, //read//, //write// and
//copy// archives. They're switched with combinations of ''-r'' and ''-w''
command line options:
^ Mode ^ RW-Options ^
| List | //no RW-options// |
| Read | ''-r'' |
| Write | ''-w'' |
| Copy | ''-r -w'' |
=== List ===
In //list mode//, ''pax'' writes the list of archive members to standard
output (a table of contents). If a pattern match is specified on the
command line, only matching filenames are printed.
=== Read ===
//Read// an archive. ''pax'' will read archive data and extract the members to the
current directory. If a pattern match is specified on the command line, only matching
filenames are extracted.
When reading an archive, the archive type is determined from the archive data.
=== Write ===
//Write// an archive, which means create a new one or append to an
existing one. All files and directories specified on the command line are inserted into
the archive. The archive is written to standard output by default.
If no files are specified on the command line, filenames are read from ''STDIN''.
The write mode is the only mode where you need to specify the archive type
with ''-x &lt;TYPE&gt;'', e.g. ''-x ustar''.
=== Copy ===
//Copy// mode is similar to ''cpio'' passthrough mode. It provides a way to replicate a complete or partial file hierarchy
(with all the ''pax'' options, e.g. rewriting groups) to another location.
==== Archive data ====
When you don't specify anything special, ''pax'' will attempt to read archive
data from standard input (read/list modes) and write archive data to
standard output (write mode). This ensures ''pax'' can be easily
used as part of a shell pipe construct, e.g. to read a compressed
archive that's decompressed in the pipe.
The option to specify the pathname of a file to be archived is ''-f''
This file will be used as input or output, depending on the operation
(read/write/list).
When pax reads an archive, it tries to guess the archive type.
However, in //write// mode, you must specify which type of archive
to append using the ''-x &lt;TYPE&gt;'' switch. If you omit this switch,
a default archive will be created (POSIX says it's implementation defined,
Berkeley ''pax'' creates ''ustar'' if no options are specified).
The following archive formats are supported (Berkeley implementation):
|ustar |POSIX TAR format (default)|
|cpio |POSIX CPIO format |
|tar |classic BSD TAR format |
|bcpio |old binary CPIO format |
|sv4cpio |SVR4 CPIO format |
|sv4crc |SVR4 CPIO format with CRC |
Berkeley ''pax'' supports options ''-z'' and ''-j'', similar to GNU ''tar'', to filter archive files through GZIP/BZIP2.
==== Matching archive members ====
In //read// and //list// modes, you can specify patterns to determine which files to list or extract.
* the pattern notation is the one known by a POSIX-shell, i.e. the one known by Bash without ''extglob''
* if the specified pattern matches a complete directory, it affects all files and subdirectories of the specified directory
* if you specify the ''-c'' option, ''pax'' will invert the matches, i.e. it matches all filenames **except** those matching the specified patterns
* if no patterns are given, ''pax'' will &quot;match&quot; (list or extract) all files from the archive
* **To avoid conflicts with shell pathname expansion, it's wise to quote patterns!**
=== Some assorted examples of patterns ===
&lt;code&gt;
pax -r &lt;myarchive.tar 'data/sales/*.txt' 'data/products/*.png'
&lt;/code&gt;
&lt;code&gt;
pax -r &lt;myarchive.tar 'data/sales/year_200[135].txt'
# should be equivalent to
pax -r &lt;myarchive.tar 'data/sales/year_2001.txt' 'data/sales/year_2003.txt' 'data/sales/year_2005.txt'
&lt;/code&gt;
===== Using pax =====
This is a brief description of using ''pax'' as a normal archiver
system, like you would use ''tar''.
==== Creating an archive ====
This task is done with basic syntax
&lt;code&gt;
# archive contents to stdout
pax -w &gt;archive.tar README.txt *.png data/
# equivalent, extract archive contents directly to a file
pax -w -x ustar -f archive.tar README.txt *.png data/
&lt;/code&gt;
''pax'' is in //write// mode, the given filenames are packed into an
archive:
* ''README.txt'' is a normal file, it will be packed
* ''*.png'' is a pathname glob **for your shell**, the shell will substitute all matching filenames **before** ''pax'' is executed. The result is a list of filenames that will be packed like the ''README.txt'' example above
* ''data/'' is a directory. **Everything** in this directory will be packed into the archive, i.e. not just an empty directory
When you specify the ''-v'' option, ''pax'' will write the pathnames of the
files inserted into the archive to ''STDERR''.
When, and only when, no filename arguments are specified, ''pax'' attempts to
read filenames from ''STDIN'', separated by newlines.
This way you can easily combine ''find'' with ''pax'':
&lt;code&gt;
find . -name '*.txt' | pax -wf textfiles.tar -x ustar
&lt;/code&gt;
==== Listing archive contents ====
The standard output format to list archive members simply is to print each
filename to a separate line. But the output format can be customized to include
permissions, timestamps, etc. with the ''-o listopt=&lt;FORMAT&gt;'' specification.
The syntax of the format specification is strongly derived from the
''printf(3)'' format specification.
**Unfortunately** the ''pax'' utility delivered with Debian doesn't seem to
support these extended listing formats.
However, ''pax'' lists archive members in a ''ls -l''-like format, when you
give the ''-v'' option:
&lt;code&gt;
pax -v &lt;myarchive.tar
# or, of course
pax -vf myarchive.tar
&lt;/code&gt;
==== Extracting from an archive ====
You can extract all files, or files (not) matching specific patterns from an
archive using constructs like:
&lt;code&gt;
# &quot;normal&quot; extraction
pax -rf myarchive.tar '*.txt'
&lt;/code&gt;
&lt;code&gt;
# with inverted pattern
pax -rf myarchive.tar -c '*.txt'
&lt;/code&gt;
==== Copying files ====
To copy directory contents to another directory, similar to a
''cp -a'' command, use:
&lt;code&gt;
mkdir destdir
pax -rw dir destdir #creates a copy of dir in destdir/, i.e. destdir/dir
&lt;/code&gt;
==== Copying files via ssh ====
To copy directory contents to another directory on a remote system, use:
&lt;code&gt;
pax -w localdir | ssh user@host &quot;cd distantdest &amp;&amp; pax -r -v&quot;
pax -w localdir | gzip | ssh user@host &quot;cd distantdir &amp;&amp; gunzip | pax -r -v&quot; #compress the sent data
&lt;/code&gt;
These commands create a copy of localdir in distandir (distantdir/dir) on the remote machine.
===== Advanced usage =====
==== Backup your daily work ====
__**Note:**__ ''-T'' is an extension and is not defined by POSIX.
Say you have write-access to a fileserver mounted on your filesystem tree.
In //copy// mode, you can tell ''pax'' to copy only files that were
modified today:
&lt;code&gt;
mkdir /n/mybackups/$(date +%A)/
pax -rw -T 0000 data/ /n/mybackups/$(date +%A)/
&lt;/code&gt;
This is done using the ''-T'' switch, which normally allows you to specify a
time window, but in this case, only the start time which means &quot;today at midnight&quot;.
When you execute this &quot;very simple backup&quot; after your daily work,
you will have a copy of the modified files.
__**Note:**__ The ''%A'' format from ''date'' expands to the name of the
current day, localized, e.g. &quot;Friday&quot; (en) or &quot;Mittwoch&quot; (de).
The same, but with an archive, can be accomplished by:
&lt;code&gt;
pax -w -T 0000 -f /n/mybackups/$(date +%A)
&lt;/code&gt;
In this case, the day-name is an archive-file (you don't need a filename
extension like ''.tar'' but you can add one, if desired).
==== Changing filenames while archiving ====
''pax'' is able to rewrite filenames while archiving or while extracting from an archive. This example creates a tar archive containing the ''holiday_2007/'' directory, but the directory name inside the archive will be ''holiday_pics/'':
&lt;code&gt;
pax -x ustar -w -f holiday_pictures.tar -s '/^holiday_2007/holiday_pics/' holiday_2007/
&lt;/code&gt;
The option responsible for the string manipulation is the ''-s &lt;REWRITE-SPECIFICATION&gt;''. It takes the string rewrite specification as an argument, in the form ''/OLD/NEW/[gp]'', which is an ''ed(1)''-like regular expression (BRE) for ''old'' and generally can be used like the popular sed construct ''s/from/to/''. Any non-null character can be used as a delimiter, so to mangle pathnames (containing slashes), you could use ''#/old/path#/new/path#''.
The optional ''g'' and ''p'' flags are used to apply substitution **(g)**lobally to the line or to **(p)**rint the original and rewritten strings to ''STDERR''.
Multiple ''-s'' options can be specified on the command line. They are applied to the pathname strings of the files or archive members. This happens in the order they are specified.
==== Excluding files from an archive ====
The -s command seen above can be used to exclude a file. The substitution must result in a null string:
For example, let's say that you want to exclude all the CVS directories to create a source code archive.
We are going to replace the names containing /CVS/ with nothing, note the .* they are needed because we need to match the entire pathname.
&lt;code&gt;
pax -w -x ustar -f release.tar -s',.*/CVS/.*,,' myapplication
&lt;/code&gt;
You can use several -s options, for instance, let's say you also want to remove files ending in ~:
&lt;code&gt;
pax -w -x ustar -f release.tar -'s,.*/CVS/.*,,' -'s/.*~//' myapplication
&lt;/code&gt;
This can also be done while reading an archive, for instance, suppose you have an archive containing a &quot;usr&quot; and a &quot;etc&quot; directory but that you want to extract only the &quot;usr&quot; directory:
&lt;code&gt;
pax -r -f archive.tar -s',^etc/.*,,' #the etc/ dir is not extracted
&lt;/code&gt;
==== Getting archive filenames from STDIN ====
Like ''cpio'', pax can read filenames from standard input (''stdin''). This provides great flexibility - for example, a ''find(1)'' command may select files/directories in ways pax can't do itself. In **write** mode (creating an archive) or **copy** mode, when no filenames are given, pax expects to read filenames from standard input. For example:
&lt;code&gt;
# Back up config files changed less than 3 days ago
find /etc -type f -mtime -3 | pax -x ustar -w -f /backups/etc.tar
# Copy only the directories, not the files
mkdir /target
find . -type d -print | pax -r -w -d /target
# Back up anything that changed since the last backup
find . -newer /var/run/mylastbackup -print0 |
pax -0 -x ustar -w -d -f /backups/mybackup.tar
touch /var/run/mylastbackup
&lt;/code&gt;
The ''-d'' option tells pax ''not'' to recurse into directories it reads (''cpio''-style). Without ''-d'', pax recurses into all directories (''tar''-style).
**Note**: the ''-0'' option is not standard, but is present in some implementations.
===== From tar to pax =====
''pax'' can handle the ''tar'' archive format, if you want to switch to the standard tool an alias like:
&lt;code&gt;
alias tar='echo USE PAX, idiot. pax is the standard archiver!; # '
&lt;/code&gt;
in your ''~/.bashrc'' can be useful :-D.
Here is a quick table comparing (GNU) ''tar'' and ''pax'' to help you to make the switch:
^ TAR ^ PAX ^ Notes ^
| ''tar xzvf file.tar.gz'' | ''pax -rvz -f file.tar.gz'' | ''-z'' is an extension, POSIXly: ''gunzip &lt;file.tar.gz %%|%% pax -rv'' |
| ''tar czvf archive.tar.gz path ...'' | ''pax -wvz -f archive.tar.gz path ...''| ''-z'' is an extension, POSIXly: ''pax -wv path %%|%% gzip &gt; archive.tar.gz'' |
| ''tar xjvf file.tar.bz2'' | ''bunzip2 &lt;file.tar.bz2 %%|%% pax -rv'' | |
| ''tar cjvf archive.tar.bz2 path ...'' | ''pax -wv path %%|%% bzip2 &gt; archive.tar.bz2'' | |
| ''tar tzvf file.tar.gz'' | ''pax -vz -f file.tar.gz'' | ''-z'' is an extension, POSIXly: ''gunzip &lt;file.tar.gz %%|%% pax -v'' |
''pax'' might not create ustar (''tar'') archives by default but its own pax format, add ''-x ustar'' if you want to ensure pax creates tar archives!
===== Implementations =====
* [[http://www2.research.att.com/sw/download/ | AT&amp;T AST toolkit]] | [[http://www2.research.att.com/~gsf/man/man1/pax.html | manpage]]
* [[http://heirloom.sourceforge.net/index.html | Heirloom toolchest]] | [[http://heirloom.sourceforge.net/man/pax.1.html | manpage]]
* [[http://www.openbsd.org/cgi-bin/cvsweb/src/bin/pax/ | OpenBSD pax]] | [[http://www.openbsd.org/cgi-bin/man.cgi?query=pax&amp;apropos=0&amp;sektion=0&amp;manpath=OpenBSD+Current&amp;arch=i386&amp;format=html | manpage]]
* [[https://launchpad.net/paxmirabilis | MirBSD pax]] | [[https://www.mirbsd.org/htman/i386/man1/pax.htm | manpage]] - Debian bases their package upon this.
* [[http://pubs.opengroup.org/onlinepubs/9699919799/utilities/pax.html | SUS pax specification]]</textarea>
<div id="wiki__editbar" class="editBar">
<div id="size__ctl">
</div>
</div>
</div></form>
</div>
</div><!-- /content --></div>
</div>
</div>
<div class="small text-right">
<span class="docInfo">
<ul class="list-inline"><li><span class="iconify text-muted" data-icon="mdi:file-document-outline"></span> <span title="howto/pax.txt">howto/pax.txt</span></li><li><span class="iconify text-muted" data-icon="mdi:calendar"></span> Last modified: <span title="2015/08/09 04:55">2015/08/09 04:55</span></li><li class="text-muted">by <bdi>bill_thomson</bdi></li></ul> </span>
</div>
</article>
</div>
</main>
<footer id="dw__footer" class="dw-container py-5 dokuwiki container-fluid">
<hr/>
<div align="center">
<h3><a target="_blank" href="http://web.archive.org/web/20221007145722/http://www.performing-databases.com/">This site is supported by Performing Databases - your experts for database administration</a></h3>
</div>
<hr/>
<div align="center">
<script async src="//web.archive.org/web/20221007145722js_/https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- BHORG_BOTTOM -->
<ins class="adsbygoogle" style="display:inline-block;width:728px;height:90px" data-ad-client="ca-pub-4658830517838678" data-ad-slot="1603598940"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
<!-- footer -->
<div class="dw-container small container-fluid mx-5">
<div class="footer-dw-title">
<div class="media">
<div class="media-left">
<img src="/web/20221007145722im_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/logo.png" alt="Bash Hackers Wiki" class="media-object" style="height:32px"/>
</div>
<div class="media-body">
<div class="row">
<div class="col-sm-2">
<h4 class="media-heading">Bash Hackers Wiki</h4>
<p>
</p>
</div>
<div class="col-sm-10">
</div>
</div>
</div>
</div>
</div>
<div class="footer-license row">
<hr/>
<div id="dw__license" class="col-sm-6">
<p>
<a href="http://web.archive.org/web/20221007145722/http://www.gnu.org/licenses/fdl-1.3.html" title="GNU Free Documentation License 1.3" target="" itemscope itemtype="http://schema.org/CreativeWork" itemprop="license" rel="license" class="license"><img src="/web/20221007145722im_/https://wiki.bash-hackers.org/lib/tpl/bootstrap3/images/license/gnufdl.png" width="24" height="24" alt="gnufdl"/> </a> </p>
<p class="small">
Except where otherwise noted, content on this wiki is licensed under the following license:<br/><a href="http://web.archive.org/web/20221007145722/http://www.gnu.org/licenses/fdl-1.3.html" title="GNU Free Documentation License 1.3" target="" itemscope itemtype="http://schema.org/CreativeWork" itemprop="license" rel="license" class="license">GNU Free Documentation License 1.3</a> </p>
</div>
<div class="col-sm-6">
</div>
</div>
</div>
<!-- /footer -->
</footer>
<a href="#dokuwiki__top" class="back-to-top hidden-print btn btn-default" title="skip to content" accesskey="t">
<span class="iconify" data-icon="mdi:chevron-up"></span> </a>
<div id="screen__mode"> <span class="visible-xs-block"></span>
<span class="visible-sm-block"></span>
<span class="visible-md-block"></span>
<span class="visible-lg-block"></span>
</div>
<img src="/web/20221007145722im_/https://wiki.bash-hackers.org/lib/exe/indexer.php?id=howto%3Apax&amp;1665154657" width="2" height="1" alt=""/>
</div>
</body>
</html>
<!--
FILE ARCHIVED ON 14:57:22 Oct 07, 2022 AND RETRIEVED FROM THE
INTERNET ARCHIVE ON 11:35:54 Apr 14, 2023.
JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE.
ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C.
SECTION 108(a)(3)).
-->
<!--
playback timings (ms):
captures_list: 78.779
exclusion.robots: 0.2
exclusion.robots.policy: 0.186
RedisCDXSource: 0.912
esindex: 0.009
LoadShardBlock: 59.481 (3)
PetaboxLoader3.datanode: 56.721 (4)
load_resource: 288.484
PetaboxLoader3.resolve: 268.032
-->