atool-0.34.0.tar.gz
[atool.git] / atool.1.in
blob1e8cb71e5d127e7a5a10ba9a74fa97c597fb422a
1 .\"                                      -*- nroff -*-
2 .\" atool.1 - Manual page for atool.
3 .\"
4 .\" Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007 Oskar Liljeblad
5 .\"
6 .\" This program is free software; you can redistribute it and/or modify
7 .\" it under the terms of the GNU General Public License as published by
8 .\" the Free Software Foundation; either version 2 of the License, or
9 .\" (at your option) any later version.
10 .\"
11 .\" This program is distributed in the hope that it will be useful,
12 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
13 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 .\" GNU Library General Public License for more details.
15 .\"
16 .\" You should have received a copy of the GNU General Public License along
17 .\" with this program; if not, write to the Free Software Foundation,
18 .\" Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 .\"
20 .TH ATOOL "1" "July 5, 2005" "atool"
21 .\" Read this file with groff -man -Tascii atool.1
22 .SH NAME
23 atool \- A script for managing file archives of various types
24 .SH SYNOPSIS
25 .B atool
26 .RI [ OPTION ]... " ARCHIVE " [ FILE ]...
27 .br
28 .B aunpack
29 .RI [ OPTION ]... " ARCHIVE " [ FILE ]...
30 .br
31 .B apack
32 .RI [ OPTION ]... " ARCHIVE " [ FILE ]...
33 .br
34 .B als
35 .RI [ OPTION ]... " ARCHIVE " [ FILE ]...
36 .br
37 .B acat
38 .RI [ OPTION ]... " ARCHIVE " [ FILE ]...
39 .br
40 .B adiff
41 .RI [ OPTION ]... " ARCHIVE " "" ARCHIVE
42 .br
43 .B arepack
44 .RI [ OPTION ]... OLD-ARCHIVE " " NEW-ARCHIVE
45 .SH DESCRIPTION
46 This manual page document describes the \fBatool\fP commands.
47 These commands are used for managing file archives of various
48 types, such as tar and Zip archives. Each command can be
49 executed individually or by giving the appropriate options
50 to \fBatool\fP (see \fBOPTIONS\fP below).
51 .PP
52 \fBaunpack\fP extracts files from an archive. Often one wants
53 to extract all files in an archive to a single subdirectory.
54 However, some archives contain multiple files in their root
55 directories. The aunpack program overcomes this problem by
56 first extracting files to a unique (temporary) directory, and
57 then moving its contents back if possible. This also prevents
58 local files from being overwritten by mistake.
59 .PP
60 \fBapack\fP creates archives (or compresses files). If no file
61 arguments are specified, filenames to add are read from standard in.
62 .PP
63 \fBals\fP lists files in an archive.
64 .PP
65 \fBacat\fP extracts files in an archive to standard out.
66 .PP
67 \fBadiff\fP generates a diff between two archives using
68 diff(1).
69 .PP
70 \fBarepack\fP repacks archives to a different format. It does
71 this by first extracting all files of the old archive into a
72 temporary directory, then packing all files extracted to
73 that directory to the new archive. Use the \-\-each (\-e) option in
74 combination with \-\-format (\-F) to repack multiple archives using a
75 single invocation of atool. Note that arepack will not remove the old
76 archive.
77 .PP
78 Unless the \fB\-\-format\fP (\fB\-F\fP) option is provided,
79 the archive format is determined by the archive file extension. I.e.
80 an extension ".tar.gz" or ".tgz" means tar+gzip format. Note that
81 the extensions are checked in the order listed in the section
82 \fBARCHIVE TYPES\fP below, which is why a file with extension ".tar.gz"
83 is considered to a be tar+gzip archive, not a gzip compressed file.
84 .SH OPTIONS
85 These programs follow the usual GNU command line syntax, with long
86 options starting with two dashes (`-').
87 A summary of options is included below.
88 .TP
89 .B \-l, \-\-list
90 List files in archive.
91 This option is automaticly assumed when \fBals\fP is executed.
92 .TP
93 .B \-x, \-\-extract
94 Extract files from archive.
95 This option is automaticly assumed when \fBaunpack\fP is executed.
96 .TP
97 .B \-X, \-\-extract-to\fR=\fIPATH\fR
98 Extract files from archive to the specified directory. When
99 unpacking compressed files, PATH may refer to either a filename
100 or an existing directory.
102 .B \-a, \-\-add
103 Create archive.
104 This option is automaticly assumed when \fBapack\fP is executed.
106 .B \-c, \-\-cat
107 Extract a file from archive to standard out (displaying it on
108 screen).
109 This option is automaticly assumed when \fBacat\fP is executed.
111 .B \-d, \-\-diff
112 Extract two archives and use diff(1) to generate differencies
113 between them.
114 This option is automaticly assumed when \fBadiff\fP is executed.
116 .B \-e, \-\-each
117 For each argument, execute the specified command. This can be used
118 to quickly extract, list or create multiple archives (see \fBEXAMPLES\fR
119 below). This option can not be used with the cat command.
121 .B \-F, \-\-format\fR=\fIEXTENSION\fR
122 Specify archive format manually (see \fBARCHIVE TYPES\fR below).
124 .B \-S, \-\-simulate
125 Run atool in simulation mode. No changes to the filesystem
126 (i.e. writes) will be made, and all commands that would be
127 executed are displayed instead. This option can't be combined
128 with \fB\-\-explain\fP (since it implies that already).
130 Note that it is not guaranteed that the commands printed in
131 simulation mode will be the same as those executed in non-
132 simulation mode. This is because some operations depend on
133 what files archives contain, and atool can at this time
134 only determine that by extracting archives.
136 .B \-E, \-\-explain
137 Display commands executed by atool. This option can't be combined
138 with \fB\-\-simulate\fP.
140 .B \-p, \-\-page
141 Run output through a pager, usually \fBpager\fP unless the environment
142 variable \fBPAGER\fP is set.
144 .B \-f, \-\-force
145 When extracting from files, allow overwriting of local files.
146 When creating an archive, allow the archive file to be overwritten
147 if it already exists. Note that it is possible to add files to
148 existing RAR and Zip archives (this is not possible for many
149 other formats).
151 .B \-D, \-\-subdir
152 When extracting archives, always create a new directory for
153 the archive even if the archive only contains one file in
154 its root directory.
156 .B \-0, \-\-null
157 If no file arguments are specified when creating or adding files
158 to archives, the list of files will be read from standard in.
159 Normally these filenames are separated by newline, but with this
160 option they are separated by null-bytes. This is useful with the
161 GNU find -print0 option.
163 .B \-q, \-\-quiet
164 Decrease verbosity level by one. This is subtracted from the
165 default verbosity level, or the level specified
166 with \fB\-\-verbosity\fP. This option may be specified more than
167 once to make atool even less verbose.
169 .B \-v, \-\-verbose
170 Increase verbosity level by one. This is added to the
171 default verbosity level, or the level specified
172 with \fB\-\-verbosity\fP. This option may be specified more than
173 once to make atool even more verbose.
175 .B \-V, \-\-verbosity\fR=\fILEVEL\fR
176 Specify verbosity level. The default level is 1,
177 which means "normal verbosity" - e.g. when creating and
178 extracting from archives, files will be listed.
180 .B \-\-config\fR=\fIFILE\fR
181 Load configuration from the specified file. When using this
182 option, the system-wide and user-wide configuration files
183 will not be loaded. If the specified file does not exist or
184 can not be read, atool will terminate with an error message.
186 .B \-\-save\-outdir\fR=\fIFILE\fR
187 When extracting files, save the name of the directory which
188 the archive was extracted to to the specified file. If the
189 command was not `extract', or the archive was not extracted to
190 a new directory, then nothing will be written to the specified
191 file. If multiple archives were specified (with -e), then
192 only the last directory that files were extracted to will be
193 written to FILE.
195 This option is used internally (see \fBEXAMPLES\fR below).
197 .B \-\-help
198 Show summary of options.
200 .B \-\-version
201 Output version information and exit.
202 .SH ARCHIVE TYPES
203 Unless the \-f (\-\-format) option is provided, the archive format
204 is determined by the archive file extension. I.e. an extension
205 ".tar.gz" or ".tgz" means tar+gzip format. Note that the extensions
206 are checked in the other listed above, which is why a file
207 with extension ".tar.gz" is considered to a tar+gzip archive,
208 not a gzip archive.
210 The diff command is supported whenever the extract command is
211 supported.
213 The supported archive types are:
215 .RI \fBtar+gzip\fP " " ( .tar.gz ", " .tgz )
216 All commands are supported.
218 .RI \fBtar+bzip\fP " " ( .tar.bz ", " .tbz )
219 All commands are supported.
221 .RI \fBtar+bzip2\fP " " ( .tar.bz2 ", " .tbz2 )
222 All commands are supported.
224 .RI \fBtar+compress\fP " " ( .tar.Z ", " .tZ )
225 All commands are supported.
227 .RI \fBtar+lzop\fP " " ( .tar.lzo ", " .tzo )
228 All commands are supported.
230 .RI \fBtar+7z\fP " " ( .tar.7z ", " .t7z )
231 All commands are supported.
233 .RI \fBtar\fP " " ( .tar )
234 All commands are supported.
236 .RI \fBzip\fP " " ( .zip )
237 All commands are supported.
239 .RI \fBjar\fP " " ( .jar ", " .war )
240 List, extract, and add commands are supported.
241 Cat is supported if use_jar_program is disabled.
243 .RI \fBrar\fP " " ( .rar )
244 All commands are supported.
246 .RI \fBlha\fP " " ( .lha ", " .lzh )
247 All commands are supported.
249 .RI \fB7z\fP " " ( .7z )
250 Extract, list and add commands are supported.
252 .RI \fBalzip\fP " " ( .alz )
253 Extract command is supported.
255 .RI \fBace\fP " " ( .ace )
256 Extract and list commands are supported.
258 .RI \fBar\fP " " ( .a )
259 All commands are supported.
261 .RI \fBarj\fP " " ( .arj )
262 List, extract and add commands are supported.
264 .RI \fBarc\fP " " ( .arc )
265 All command are supported.
266 (Note that arc outputs an extra newline when the cat command is used.)
268 .RI \fBrpm\fP " " ( .rpm )
269 Extract and list commands are supported.
271 .RI \fBdeb\fP " " ( .deb )
272 Extract and list commands are supported.
274 .RI \fBcab\fP " " ( .cab )
275 Cat, extract, and list commands are supported.
277 .RI \fBgzip\fP " " ( .gz )
278 Cat, extract, and add commands are supported.
280 .RI \fBbzip\fP " " ( .bz )
281 Cat, extract, and add commands are supported.
283 .RI \fBbzip2\fP " " ( .bz2 )
284 Cat, extract, and add commands are supported.
286 .RI \fBcompress\fP " " ( .Z )
287 Cat, extract, and add commands are supported.
289 .RI \fBlzma\fP " " ( .lzma )
290 Cat, extract, and add commands are supported.
292 .RI \fBlzop\fP " " ( .lzo )
293 Cat, extract, and add commands are supported.
295 .RI \fB7zip\fP " " ( .7z )
296 All commands are supported.
297 (Note that 7z refuses to write extracted files to standard out
298 if standard out is a terminal. Use -p or pipe the output
299 of atool/acat to a pager when reading in a terminal.)
301 .RI \fBcpio\fP " " ( .cpio )
302 List, extract and add commands are supported.
305 .SH CONFIGURATION
306 Since version 0.8.0, atool can read custom configuration files.
307 First, hardcoded defaults in the atool program file are evaluated.
308 Then system-wide configuration values are loaded from
309 \fI/etc/atool.conf\fR if that file exists. Finally, per-user
310 configuration values are loaded from \fI.atoolrc\fR in the current
311 user's home directory.
313 The format of the configuration files is simple:
315 variable value
317 Here \fBvariable\fR is a variable listed below, and \fBvalue\fR is the
318 value to associate the variable with. \fBvariable\fR and \fBvalue\fR
319 should be separated with at least one whitespace (space, tab etc). Empty
320 lines and lines beginning with # are discarded.
322 A value of `1' means that the option is enabled, and `0'
323 that it is disabled. Strings should not be quoted, as they start at
324 the first non-whitespace character and end at the end of the line.
326 The options are:
328 .B use_tar_bzip2_option \fR(default: 1)\fR
329 Enable this if you use GNU tar and it supports the \fB\--bzip2\fP option
330 for filtering bzip2'ed files through bzip2. Versions 1.13.6
331 or later of GNU tar support \fB\--bzip2\fP. Therefore, if you use
332 GNU tar earlier than 1.13.6, you will need to disable this option.
334 This used to be \fBuse_tar_j_option\fP but using --bzip2 is more portable.
336 .B use_tar_z_option \fR(default: 1)\fR
337 Enable this if you use GNU tar and it supports the \fB-z\fP option
338 for filtering gzipped files through gzip. You will need to disable
339 this and \fIuse_tar_j_option\fR if you don't use GNU tar.
341 Disabling these two options doesn't mean that atool can't
342 extract bzip2/gzip files. If disabled, atool use a pipe to
343 send output from bzip2/gzip to tar instead.
345 If possible, these options should be enabled since error
346 management is better when filtering is done by tar.
348 .B use_gzip_for_z \fR(default: 1)\fR
349 Enable this if you want to use gzip instead of uncompress when
350 decompressing compress'ed files (`.Z' files).
352 .B use_rar_for_unpack \fR(default: 0)\fR
353 Enable this if you want to always use rar instead of unrar
354 when possible. This makes atool use the rar command
355 (path_rar) even when listing and extracting RAR files.
357 .B use_arc_for_unpack \fR(default: 0)\fR
358 Enable this if you want to always use arc instead of nomarch
359 when possible. This makes atool use the arc command
360 (path_arc) even when listing and extracting ARC files.
362 .B use_arj_for_unpack \fR(default: 0)\fR
363 Enable this if you want to always use arj instead of unarj
364 when possible. This makes atool use the arj command
365 (path_arj) even when listing and extracting ARJ files.
367 .B use_find_cpio_print0 \fR(default: 1)\fR
368 Enable this if find supports the -print0 option and cpio supports
369 the -0 option. Without it, it is impossible/harder to make cpio
370 archives of files with newline characters in their names.
372 .B extract_deb_control \fR(default: 1)\fR
373 Debian .deb package files contain control information in a DEBIAN
374 directory, especially the package's "control" file. Enable this if
375 you want the control information to be exctracted during extraction in
376 addition to the normal files.
378 .B strip_unknown_ext \fR(default: 1)\fR
379 Certain types of files are actually archives, but their extensions
380 doesn't tell so. Examples are Open Office documents (Zip files) and
381 Gnumeric documents (gzip'ed files). Since the extensions of those
382 filenames are unknown to atool, they would not be stripped with
383 this option set to 0. The output file in that case would be something
384 like Unpack-XYZW. Setting this option to 1 will cause the extension
385 to be stripped instead.
387 .B use_jar \fR(default: 0)\fR
388 Enable this if you want to use jar for managing jar
389 archives. If you disable this option, zip will be
390 used (which should work just as well, and probably be
391 faster too).
393 This option is disabled by default since extracting
394 files to standard out (`cat') is not supported by jar.
396 .B use_file \fR(default: 1)\fR
397 Enable this if you want atool to identify file types
398 using file(1) for those files with an unrecognized
399 extension (or none at all).
400     
401 Note that tar-archives compressed with a file compressor
402 (such as gzip, bzip2 and so on) can't be identified this way.
403 For this reason, files packed with gzip and other file
404 compressors are not identified either.
406 .B tmpdir_name \fR(default: Unpack-%04d)\fR
407 atool extracts to a temporary directory created in the current
408 directory so that no files are overwritten. This variable
409 controlls what name that temporary directory should have.
411 The `%d' string in this variable will be replaced with a random
412 number between 0 and 9999. It is possible change the format
413 of this number by using something else than `%d' - see printf(3).
415 .B path_pager \fR(default: pager)\fR
417 .B path_jar \fR(default: jar)\fR
419 .B path_tar \fR(default: tar)\fR
421 .B path_zip \fR(default: zip)\fR
423 .B path_unzip \fR(default: unzip)\fR
425 .B path_gzip \fR(default: gzip)\fR
427 .B path_bzip \fR(default: bzip)\fR
429 .B path_bzip2 \fR(default: bzip2)\fR
431 .B path_compress \fR(default: compress)\fR
433 .B path_lzma \fR(default: lzma)\fR
435 .B path_lzop \fR(default: lzop)\fR
437 .B path_rar \fR(default: rar)\fR
439 .B path_unrar \fR(default: unrar)\fR
441 .B path_cabextract \fR(default: cabextract)\fR
443 .B path_7z \fR(default: 7z)\fR
445 .B path_unalz \fR(default: unalz)\fR
447 .B path_lha \fR(default: lha)\fR
449 .B path_unace \fR(default: unace)\fR
451 .B path_ar \fR(default: ar)\fR
453 .B path_arj \fR(default: arj)\fR
455 .B path_unarj \fR(default: unarj)\fR
457 .B path_arc \fR(default: arc)\fR
459 .B path_nomarch \fR(default: nomarch)\fR
461 .B path_rpm \fR(default: rpm)\fR
463 .B path_rpm2cpio \fR(default: rpm2cpio)\fR
465 .B path_dpkg_deb \fR(default: dpkg-deb)\fR
467 .B path_cpio \fR(default: cpio)\fR
469 .B path_file \fR(default: file)\fR
471 .B path_find \fR(default: find)\fR
473 .B path_xargs \fR(default: xargs)\fR
475 .B path_cat \fR(default: cat)\fR
477 .B path_diff \fR(default: diff)\fR
478 These are all paths to the corresponding programs. It is usually
479 best to leave them as is, because that way their locations can be
480 looked up from the PATH variable.
482 .B args_diff \fR(default: -ru)\fR
483 This variable specifies command line arguments to pass to the
484 diff command (as specified by path_diff) when using adiff. Space
485 characters separate arguments in this string.
487 .B path_syscfg \fR(default: /etc/atool.conf)\fR
488 (This variable can only be set in the atool program file.)
489 This variable specifies the directory where the system-wide
490 configuration file is located.
492 .B path_usercfg \fR(default: .atoolrc)\fR
493 (This variable can only be set in the atool program file
494 and system-wide configuration file.)
495 This variable specifies where the user configuration file
496 is located. Note that if this filename is relative (i.e. doesn't
497 being with `/'), it will be relative to the current user's home
498 directory (as determined by the HOME environment variable).
500 .B default_verbosity \fR(default: 1)\fR
501 This is the default verbosity of atool. By using -q and -v
502 options, the verbosity level can be raised and lowered.
503 Level 1 means "normal verbosity" - e.g. when creating and
504 extracting from archives, files will be listed.
506 .B show_extracted \fR(default: 1)\fR
507 If this is set to 1, the aunpack command will always show
508 what file or directory that was extracted. Otherwise
509 that will only be printed if the archive was extracted to
510 an unexpected location (as a result of local files already
511 existing or the archive having multiple files in its root
512 directory).
514 This can be quite useful in combinatiaon with `default_verbosity 0'.
515 Note that this option will have no effect when the -X option is used
516 with aunpack, and it has no effect on compressed files.
518 .B keep_compressed \fR(default: 1)\fR
519 When compressing a file with gzip or bzip2, the original (uncompressed)
520 file is usually deleted once it has been compressed. I.e. if you
521 compress a file "test" you will end up with only one file, "test.gz".
522 With this option set to 1, you will make atool keep the original file
523 as well. The original behaviour is achieved by setting this option to 0.
525 This option also has an equivalent effect on uncompressing compressed
526 files. When set to 1, the original (compressed) file will be kept.
527 Otherwise it will be deleted.
529 Note however that this option has no effect when packing up a compressed
530 file with the -X option (for specifying an output directory or file). In
531 that case the original file is always kept.
533 .B decompress_to_cwd \fR(default: 1)\fR
534 When decompressing a file with commands such as gzip or bzip2, the
535 decompressed file is usually placed in the same directory as the
536 compressed file. With this option set to 1, the decompressed file is
537 instead placed in the current working directory.
539 Note that this option has no effect when -X is used.
541 .SH ENVIRONMENT VARIABLES
542 .B PAGER
543 The default pager to use when the -p/--page option is specified.
544 .SH EXAMPLES
545 To extract all files from archive `foobar.tar.gz' to a subdirectory
546 (or the current directory if it only contains one file):
548         \fBaunpack foobar.tar.gz\fP
550 To extract all files from all `.tar.gz' archives in the
551 current directory:
553         \fBaunpack -e *.tar.gz\fP
555 To create a zip archive of two files `foo' and `bar':
557         \fBapack myarchive.zip foo bar\fP
559 To display the file `baz' in the archive `myarchive.zip'
560 through a pager:
562         \fBacat -p myarchive.zip baz\fP
564 To list contents of the rar archive `stuff.rar':
566         \fBals stuff.rar\fP
568 To create three archives, `dir1.tar.gz', `dir2.tar.gz' and `dir3.tar.gz',
569 so that the first one contains all files in dir1, the second all
570 in dir2 and the third all dir3:
572         \fBapack -e -F .tar.gz dir1 dir2 dir3\fP
574 To show all differences between version 2.4.17 and 2.4.18 of the kernel:
576         \fBadiff linux-2.4.17.tar.gz linux-2.4.18.tar.gz\fP
578 To repack all .tar.gz archives in the current directory to .tar.7z (the
579 old archive will be kept untouched):
581         \fBarepack -F.tar.7z -e *.tar.gz\fP
583 Here's a shell function that will make the aunpack command change into the
584 directory where files were extracted:
586         \fBaunpack () {\fP
588         \fB  TMP=`mktemp /tmp/aunpack.XXXXXXXXXX`\fP
590         \fB  atool -x --save-outdir=$TMP "$@"\fP
592         \fB  DIR="`cat $TMP`"\fP
594         \fB  [ "$DIR" != "" -a -d "$DIR" ] && cd "$DIR"\fP
596         \fB  rm $TMP\fP
598         \fB}\fP
600 If you don't have the mktemp program, you can replace the second line with
601 (note however that this is not entirely safe)
603         \fB  TMP="/tmp/atool_outdir.$$"\fP
605 .SH KNOWN BUGS
606 Trying to extract gzip and other compressed files without the .gz (or .bz2
607 etc) extension won't work:
609   aunpack: foo: format not known, identifying using file
610   aunpack: foo: format is `gzip'
611   gzip: foo: unknown suffix -- ignored
613 This last error above is generated by \fBgzip -d foo\fP.
615 If you find a bug not listed here, please report it to <@PACKAGE_BUGREPORT@>.
616 .SH REPORTING BUGS
617 Report bugs to <\fIoskar@osk.mine.nu\fP>.
618 .SH AUTHOR
619 The author of \fBatool\fP and this manual page is Oskar Liljeblad <\fIoskar@osk.mine.nu\fP>.
620 .SH COPYRIGHT
621 Copyright \(co 2001, 2002, 2003, 2004, 2005 Oskar Liljeblad
623 This is free software; see the source for copying conditions.  There is NO
624 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.