Makefile: Warn users of pkgx.dev about their poor life choices
[moreutils.git] / parallel.docbook
blob87e58787b21e94d007f4f62b038296599e995f2f
1 <?xml version="1.0" encoding="utf-8"?>
3 <!--
5 Written by Joey Hess
7 -->
9 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook V4.4//EN"
10 "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd"
11 []>
13 <refentry>
14 <refentryinfo>
15 <address>
16 <email>id@joeyh.name</email>
17 </address>
18 <author>
19 <firstname>Joey</firstname>
20 <surname>Hess</surname>
21 </author>
22 <date>2009-07-02</date>
23 </refentryinfo>
25 <refmeta>
26 <refentrytitle>parallel</refentrytitle>
27 <manvolnum>1</manvolnum>
28 <refmiscinfo class="manual">moreutils</refmiscinfo>
29 <refmiscinfo class="source">moreutils</refmiscinfo>
30 </refmeta>
32 <refnamediv>
33 <refname>parallel</refname>
34 <refpurpose>run programs in parallel</refpurpose>
35 </refnamediv>
37 <refsynopsisdiv>
38 <cmdsynopsis>
39 <command>parallel</command>
40 <arg>options</arg>
41 <arg>command</arg>
42 <command>--</command>
43 <arg>argument ...</arg>
44 </cmdsynopsis>
45 <cmdsynopsis>
46 <command>parallel</command>
47 <arg>options</arg>
48 <command>--</command>
49 <arg>command ...</arg>
50 </cmdsynopsis>
51 </refsynopsisdiv>
53 <refsect1>
54 <title>DESCRIPTION</title>
56 <para><command>parallel</command> runs the specified command,
57 passing it a single one of the specified arguments. This is
58 repeated for each argument. Jobs may be run in
59 parallel. The default is to run one job per CPU.</para>
61 <para>If no command is specified before the --,
62 the commands after it are instead run in parallel.</para>
64 </refsect1>
66 <refsect1>
67 <title>OPTIONS</title>
69 <variablelist>
71 <varlistentry>
72 <term><option>-j maxjobs</option></term>
73 <listitem>
74 <para>Use to limit the number of jobs
75 that are run at the same time.</para>
76 </listitem>
77 </varlistentry>
79 <varlistentry>
80 <term><option>-l maxload</option></term>
81 <listitem>
82 <para>Wait as needed to avoid starting
83 new jobs when the system's load average
84 is not below the specified limit.</para>
85 </listitem>
86 </varlistentry>
88 <varlistentry>
89 <term><option>-i</option></term>
90 <listitem>
91 <para>Normally the command is passed the
92 argument at the end of its command line. With
93 this option, any instances of "{}" in
94 the command are replaced with the argument.</para>
95 </listitem>
96 </varlistentry>
98 <varlistentry>
99 <term><option>-n</option></term>
100 <listitem>
101 <para>Number of arguments to pass to a
102 command at a time. Default is 1.
103 Incompatible with -i</para>
104 </listitem>
105 </varlistentry>
107 </variablelist>
109 </refsect1>
111 <refsect1>
112 <title>EXAMPLE</title>
114 <para>
115 <command>parallel sh -c "echo hi; sleep 2; echo bye" -- 1 2 3</command>
116 </para>
118 <para>This runs three subshells that each print a message, delay,
119 and print another message. If your system has multiple
120 CPUs, parallel will run some of the jobs in parallel,
121 which should be clear from the order the messages are
122 output.
123 </para>
125 <para>
126 <command>parallel -j 3 ufraw -o processed -- *.NEF</command>
127 </para>
129 <para>This runs three ufraw processes at the same time until
130 all of the NEF files have been processed.
131 </para>
133 <para>
134 <command>parallel -j 3 -- ls df "echo hi"</command>
135 </para>
137 <para>This runs three independent commands in parallel.</para>
139 </refsect1>
141 <refsect1>
142 <title>EXIT STATUS</title>
145 <para>Its exit status is the combination of the exit statuses of each
146 command ran, ORed together. (Thus, if any one command
147 exits nonzero, <command>parallel</command> as a whole will exit nonzero.)</para>
149 </refsect1>
151 <refsect1>
152 <title>NOTES</title>
154 <para>
155 All output to stdout and stderr is serialised through a
156 corresponding internal pipe, in order to prevent annoying
157 concurrent output behaviour. Note that serialisation is not
158 done on any other file descriptors and file position based
159 access to a nonstandard file descriptor might have unexpected
160 results.
161 </para>
163 </refsect1>
165 <refsect1>
166 <title>AUTHOR</title>
167 <para>
168 Tollef Fog Heen
169 </para>
170 </refsect1>
172 </refentry>