\input texinfo
@setfilename parallel.info

@documentencoding utf-8

@settitle parallel - build and execute shell command lines from standard input in parallel

@node Top
@top parallel

@menu
* NAME::
* SYNOPSIS::
* DESCRIPTION::
* OPTIONS::
* EXAMPLES::
* SPREADING BLOCKS OF DATA::
* TIME POSTFIXES::
* UNIT PREFIX::
* QUOTING::
* LIST RUNNING JOBS::
* COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS::
* ENVIRONMENT VARIABLES::
* DEFAULT PROFILE (CONFIG FILE)::
* PROFILE FILES::
* EXIT STATUS::
* DIFFERENCES BETWEEN GNU Parallel AND ALTERNATIVES::
* BUGS::
* REPORTING BUGS::
* AUTHOR::
* LICENSE::
* DEPENDENCIES::
* SEE ALSO::
@end menu

@node NAME
@chapter NAME

parallel - build and execute shell command lines from standard input
in parallel

@node SYNOPSIS
@chapter SYNOPSIS

@strong{parallel} [options] [@emph{command} [arguments]] < list_of_arguments

@strong{parallel} [options] [@emph{command} [arguments]] ( @strong{:::} arguments |
@strong{:::+} arguments | @strong{::::} argfile(s) | @strong{::::+} argfile(s) ) ...

@strong{parallel} --semaphore [options] @emph{command}

@strong{#!/usr/bin/parallel} --shebang [options] [@emph{command} [arguments]]

@strong{#!/usr/bin/parallel} --shebang-wrap [options] [@emph{command}
[arguments]]

@node DESCRIPTION
@chapter DESCRIPTION

STOP!

Read the @strong{Reader's guide} below if you are new to GNU @strong{parallel}.

GNU @strong{parallel} is a shell tool for executing jobs in parallel using
one or more computers. A job can be a single command or a small script
that has to be run for each of the lines in the input. The typical
input is a list of files, a list of hosts, a list of users, a list of
URLs, or a list of tables. A job can also be a command that reads from
a pipe. GNU @strong{parallel} can then split the input into blocks and pipe
a block into each command in parallel.

If you use xargs and tee today you will find GNU @strong{parallel} very easy
to use as GNU @strong{parallel} is written to have the same options as
xargs. If you write loops in shell, you will find GNU @strong{parallel} may
be able to replace most of the loops and make them run faster by
running several jobs in parallel.

GNU @strong{parallel} makes sure output from the commands is the same output
as you would get had you run the commands sequentially. This makes it
possible to use output from GNU @strong{parallel} as input for other
programs.

For each line of input GNU @strong{parallel} will execute @emph{command} with
the line as arguments. If no @emph{command} is given, the line of input is
executed. Several lines will be run in parallel. GNU @strong{parallel} can
often be used as a substitute for @strong{xargs} or @strong{cat | bash}.

@menu
* Reader's guide::
@end menu

@node Reader's guide
@section Reader's guide

GNU @strong{parallel} includes the 4 types of documentation: Tutorial,
how-to, reference and explanation/design.

@menu
* Tutorial::
* How-to::
* Reference::
* Design discussion::
@end menu

@node Tutorial
@subsection Tutorial

If you prefer reading a book buy @strong{GNU Parallel 2018} at
https://www.lulu.com/shop/ole-tange/gnu-parallel-2018/paperback/product-23558902.html
or download it at: https://doi.org/10.5281/zenodo.1146014 Read at
least chapter 1+2. It should take you less than 20 minutes.

Otherwise start by watching the intro videos for a quick introduction:
https://youtube.com/playlist?list=PL284C9FF2488BC6D1

If you want to dive deeper: spend a couple of hours walking through
the tutorial (@strong{man parallel_tutorial}). Your command line will love
you for it.

@node How-to
@subsection How-to

You can find a lot of examples of use in @strong{man
parallel_examples}. They will give you an idea of what GNU @strong{parallel}
is capable of, and you may find a solution you can simply adapt to
your situation.

If the example do not cover your exact needs, the options map
(https://www.gnu.org/software/parallel/parallel_options_map.pdf) can
help you identify options that are related, so you can look these up
in the man page.

@node Reference
@subsection Reference

If you need a one page printable cheat sheet you can find it on:
https://www.gnu.org/software/parallel/parallel_cheat.pdf

The man page is the reference for all options, and reading the man
page from cover to cover is probably not what you need.

@node Design discussion
@subsection Design discussion

If you want to know the design decisions behind GNU @strong{parallel}, try:
@strong{man parallel_design}. This is also a good intro if you intend to
change GNU @strong{parallel}.

@node OPTIONS
@chapter OPTIONS

@table @asis
@item @emph{command}
@anchor{@emph{command}}

Command to execute.

If @emph{command} or the following arguments contain
replacement strings (such as @strong{@{@}}) every instance will be substituted
with the input.

If @emph{command} is given, GNU @strong{parallel} solve the same tasks as
@strong{xargs}. If @emph{command} is not given GNU @strong{parallel} will behave
similar to @strong{cat | sh}.

The @emph{command} must be an executable, a script, a composed command, an
alias, or a function.

@strong{Bash functions}: @strong{export -f} the function first or use @strong{env_parallel}.

@strong{Bash, Csh, or Tcsh aliases}: Use @strong{env_parallel}.

@strong{Zsh, Fish, Ksh, and Pdksh functions and aliases}: Use @strong{env_parallel}.

@item @strong{@{@}}
@anchor{@strong{@{@}}}

Input line.

This replacement string will be replaced by a full line read from the
input source. The input source is normally stdin (standard input), but
can also be given with @strong{--arg-file}, @strong{:::}, or @strong{::::}.

The replacement string @strong{@{@}} can be changed with @strong{-I}.

If the command line contains no replacement strings then @strong{@{@}} will be
appended to the command line.

Replacement strings are normally quoted, so special characters are not
parsed by the shell. The exception is if the command starts with a
replacement string; then the string is not quoted.

See also: @strong{--plus} @strong{@{.@}} @strong{@{/@}} @strong{@{//@}} @strong{@{/.@}} @strong{@{#@}} @strong{@{%@}}
@strong{@{}@emph{n}@strong{@}} @strong{@{=}@emph{perl expression}@strong{=@}}

@item @strong{@{.@}}
@anchor{@strong{@{.@}}}

Input line without extension.

This replacement string will be replaced by the input with the
extension removed. If the input line contains @strong{.} after the last
@strong{/}, the last @strong{.} until the end of the string will be removed and
@strong{@{.@}} will be replaced with the remaining. E.g. @emph{foo.jpg} becomes
@emph{foo}, @emph{subdir/foo.jpg} becomes @emph{subdir/foo},
@emph{sub.dir/foo.jpg} becomes @emph{sub.dir/foo}, @emph{sub.dir/bar} remains
@emph{sub.dir/bar}. If the input line does not contain @strong{.} it will remain
unchanged.

The replacement string @strong{@{.@}} can be changed with @strong{--extensionreplace}

See also: @strong{@{@}} @strong{--extensionreplace}

@item @strong{@{/@}}
@anchor{@strong{@{/@}}}

Basename of input line.

This replacement string will be replaced by the input with the
directory part removed.

See also: @strong{@{@}} @strong{--basenamereplace}

@item @strong{@{//@}}
@anchor{@strong{@{//@}}}

Dirname of input line.

This replacement string will be replaced by the dir of the input
line. See @strong{dirname}(1).

See also: @strong{@{@}} @strong{--dirnamereplace}

@item @strong{@{/.@}}
@anchor{@strong{@{/.@}}}

Basename of input line without extension.

This replacement string will be replaced by the input with the
directory and extension part removed.  @strong{@{/.@}} is a combination of
@strong{@{/@}} and @strong{@{.@}}.

See also: @strong{@{@}} @strong{--basenameextensionreplace}

@item @strong{@{#@}}
@anchor{@strong{@{#@}}}

Sequence number of the job to run.

This replacement string will be replaced by the sequence number of the
job being run. It contains the same number as $PARALLEL_SEQ.

See also: @strong{@{@}} @strong{--seqreplace}

@item @strong{@{%@}}
@anchor{@strong{@{%@}}}

Job slot number.

This replacement string will be replaced by the job's slot number
between 1 and number of jobs to run in parallel. There will never be 2
jobs running at the same time with the same job slot number.

If the job needs to be retried (e.g using @strong{--retries} or
@strong{--retry-failed}) the job slot is not automatically updated. You
should then instead use @strong{$PARALLEL_JOBSLOT}:

@verbatim
  $ do_test() {
      id="$3 {%}=$1 PARALLEL_JOBSLOT=$2"
      echo run "$id";
      sleep 1
      # fail if {%} is odd
      return `echo $1%2 | bc`
    }
  $ export -f do_test
  $ parallel -j3 --jl mylog do_test {%} \$PARALLEL_JOBSLOT {} ::: A B C D
  run A {%}=1 PARALLEL_JOBSLOT=1
  run B {%}=2 PARALLEL_JOBSLOT=2
  run C {%}=3 PARALLEL_JOBSLOT=3
  run D {%}=1 PARALLEL_JOBSLOT=1
  $ parallel --retry-failed -j3 --jl mylog do_test {%} \$PARALLEL_JOBSLOT {} ::: A B C D
  run A {%}=1 PARALLEL_JOBSLOT=1
  run C {%}=3 PARALLEL_JOBSLOT=2
  run D {%}=1 PARALLEL_JOBSLOT=3
@end verbatim

Notice how @{%@} and $PARALLEL_JOBSLOT differ in the retry run of C and D.

See also: @strong{@{@}} @strong{--jobs} @strong{--slotreplace}

@item @strong{@{}@emph{n}@strong{@}}
@anchor{@strong{@{}@emph{n}@strong{@}}}

Argument from input source @emph{n} or the @emph{n}'th argument.

This positional replacement string will be replaced by the input from
input source @emph{n} (when used with @strong{--arg-file} or @strong{::::}) or with the
@emph{n}'th argument (when used with @strong{-N}). If @emph{n} is negative it refers
to the @emph{n}'th last argument.

See also: @strong{@{@}} @strong{@{}@emph{n}.@strong{@}} @strong{@{}@emph{n}/@strong{@}} @strong{@{}@emph{n}//@strong{@}}
@strong{@{}@emph{n}/.@strong{@}}

@item @strong{@{}@emph{n}.@strong{@}}
@anchor{@strong{@{}@emph{n}.@strong{@}}}

Argument from input source @emph{n} or the @emph{n}'th argument without
extension.

@strong{@{}@emph{n}.@strong{@}} is a combination of @strong{@{}@emph{n}@strong{@}} and @strong{@{.@}}.

This positional replacement string will be replaced by the input from
input source @emph{n} (when used with @strong{--arg-file} or @strong{::::}) or with the
@emph{n}'th argument (when used with @strong{-N}). The input will have the
extension removed.

See also: @strong{@{}@emph{n}@strong{@}} @strong{@{.@}}

@item @strong{@{}@emph{n}/@strong{@}}
@anchor{@strong{@{}@emph{n}/@strong{@}}}

Basename of argument from input source @emph{n} or the @emph{n}'th argument.

@strong{@{}@emph{n}/@strong{@}} is a combination of @strong{@{}@emph{n}@strong{@}} and @strong{@{/@}}.

This positional replacement string will be replaced by the input from
input source @emph{n} (when used with @strong{--arg-file} or @strong{::::}) or with the
@emph{n}'th argument (when used with @strong{-N}). The input will have the
directory (if any) removed.

See also: @strong{@{}@emph{n}@strong{@}} @strong{@{/@}}

@item @strong{@{}@emph{n}//@strong{@}}
@anchor{@strong{@{}@emph{n}//@strong{@}}}

Dirname of argument from input source @emph{n} or the @emph{n}'th argument.

@strong{@{}@emph{n}//@strong{@}} is a combination of @strong{@{}@emph{n}@strong{@}} and @strong{@{//@}}.

This positional replacement string will be replaced by the dir of the
input from input source @emph{n} (when used with @strong{--arg-file} or @strong{::::}) or with
the @emph{n}'th argument (when used with @strong{-N}). See @strong{dirname}(1).

See also: @strong{@{}@emph{n}@strong{@}} @strong{@{//@}}

@item @strong{@{}@emph{n}/.@strong{@}}
@anchor{@strong{@{}@emph{n}/.@strong{@}}}

Basename of argument from input source @emph{n} or the @emph{n}'th argument
without extension.

@strong{@{}@emph{n}/.@strong{@}} is a combination of @strong{@{}@emph{n}@strong{@}}, @strong{@{/@}}, and
@strong{@{.@}}.

This positional replacement string will be replaced by the input from
input source @emph{n} (when used with @strong{--arg-file} or @strong{::::}) or with the
@emph{n}'th argument (when used with @strong{-N}). The input will have the
directory (if any) and extension removed.

See also: @strong{@{}@emph{n}@strong{@}} @strong{@{/.@}}

@item @strong{@{=}@emph{perl expression}@strong{=@}}
@anchor{@strong{@{=}@emph{perl expression}@strong{=@}}}

Replace with calculated @emph{perl expression}.

@strong{$_} will contain the same as @strong{@{@}}. After evaluating @emph{perl
expression} @strong{$_} will be used as the value. It is recommended to only
change $_ but you have full access to all of GNU @strong{parallel}'s
internal functions and data structures.

The expression must give the same result if evaluated twice -
otherwise the behaviour is undefined. E.g. this will not work as expected:

@verbatim
    parallel echo '{= $_= ++$wrong_counter =}' ::: a b c
@end verbatim

A few convenience functions and data structures have been made:

@table @asis
@item @strong{Q(}@emph{string}@strong{)}
@anchor{@strong{Q(}@emph{string}@strong{)}}

shell quote a string

@item @strong{pQ(}@emph{string}@strong{)}
@anchor{@strong{pQ(}@emph{string}@strong{)}}

perl quote a string

@item @strong{uq()} (or @strong{uq})
@anchor{@strong{uq()} (or @strong{uq})}

do not quote current replacement string

@item @strong{hash(val)}
@anchor{@strong{hash(val)}}

compute B::hash(val)

@item @strong{total_jobs()}
@anchor{@strong{total_jobs()}}

number of jobs in total

@item @strong{slot()}
@anchor{@strong{slot()}}

slot number of job

@item @strong{seq()}
@anchor{@strong{seq()}}

sequence number of job

@item @strong{@@arg}
@anchor{@strong{@@arg}}

the arguments

@item @strong{skip()}
@anchor{@strong{skip()}}

skip this job (see also @strong{--filter})

@item @strong{yyyy_mm_dd_hh_mm_ss(sec)} (alpha testing)
@anchor{@strong{yyyy_mm_dd_hh_mm_ss(sec)} (alpha testing)}

@item @strong{yyyy_mm_dd_hh_mm(sec)} (alpha testing)
@anchor{@strong{yyyy_mm_dd_hh_mm(sec)} (alpha testing)}

@item @strong{yyyy_mm_dd(sec)} (alpha testing)
@anchor{@strong{yyyy_mm_dd(sec)} (alpha testing)}

@item @strong{hh_mm_ss(sec)} (alpha testing)
@anchor{@strong{hh_mm_ss(sec)} (alpha testing)}

@item @strong{hh_mm(sec)} (alpha testing)
@anchor{@strong{hh_mm(sec)} (alpha testing)}

@item @strong{yyyymmddhhmmss(sec)} (alpha testing)
@anchor{@strong{yyyymmddhhmmss(sec)} (alpha testing)}

@item @strong{yyyymmddhhmm(sec)} (alpha testing)
@anchor{@strong{yyyymmddhhmm(sec)} (alpha testing)}

@item @strong{yyyymmdd(sec)} (alpha testing)
@anchor{@strong{yyyymmdd(sec)} (alpha testing)}

@item @strong{hhmmss(sec)} (alpha testing)
@anchor{@strong{hhmmss(sec)} (alpha testing)}

@item @strong{hhmm(sec)} (alpha testing)
@anchor{@strong{hhmm(sec)} (alpha testing)}

time functions. @emph{sec} is number of seconds since epoch. If left out
it will use current local time.

@end table

Example:

@verbatim
  seq 10 | parallel echo {} + 1 is {= '$_++' =}
  parallel csh -c {= '$_="mkdir ".Q($_)' =} ::: '12" dir'
  seq 50 | parallel echo job {#} of {= '$_=total_jobs()' =}
@end verbatim

See also: @strong{--rpl} @strong{--parens} @strong{@{@}} @strong{@{=}@emph{n} @emph{perl expression}@strong{=@}}
@strong{--filter}

@item @strong{@{=}@emph{n} @emph{perl expression}@strong{=@}}
@anchor{@strong{@{=}@emph{n} @emph{perl expression}@strong{=@}}}

Positional equivalent to @strong{@{=}@emph{perl expression}@strong{=@}}.

To understand positional replacement strings see @strong{@{}@emph{n}@strong{@}}.

See also: @strong{@{=}@emph{perl expression}@strong{=@}} @strong{@{}@emph{n}@strong{@}}

@item @strong{:::} @emph{arguments}
@anchor{@strong{:::} @emph{arguments}}

Use arguments on the command line as input source.

Unlike other options for GNU @strong{parallel} @strong{:::} is placed after the
@emph{command} and before the arguments.

The following are equivalent:

@verbatim
  (echo file1; echo file2) | parallel gzip
  parallel gzip ::: file1 file2
  parallel gzip {} ::: file1 file2
  parallel --arg-sep ,, gzip {} ,, file1 file2
  parallel --arg-sep ,, gzip ,, file1 file2
  parallel ::: "gzip file1" "gzip file2"
@end verbatim

To avoid treating @strong{:::} as special use @strong{--arg-sep} to set the
argument separator to something else.

If multiple @strong{:::} are given, each group will be treated as an input
source, and all combinations of input sources will be
generated. E.g. ::: 1 2 ::: a b c will result in the combinations
(1,a) (1,b) (1,c) (2,a) (2,b) (2,c). This is useful for replacing
nested for-loops.

@strong{:::}, @strong{::::}, and @strong{--arg-file} can be mixed. So these are equivalent:

@verbatim
  parallel echo {1} {2} {3} ::: 6 7 ::: 4 5 ::: 1 2 3
  parallel echo {1} {2} {3} :::: <(seq 6 7) <(seq 4 5) \
    :::: <(seq 1 3)
  parallel -a <(seq 6 7) echo {1} {2} {3} :::: <(seq 4 5) \
    :::: <(seq 1 3)
  parallel -a <(seq 6 7) -a <(seq 4 5) echo {1} {2} {3} \
    ::: 1 2 3
  seq 6 7 | parallel -a - -a <(seq 4 5) echo {1} {2} {3} \
    ::: 1 2 3
  seq 4 5 | parallel echo {1} {2} {3} :::: <(seq 6 7) - \
    ::: 1 2 3
@end verbatim

See also: @strong{--arg-sep} @strong{--arg-file} @strong{::::} @strong{:::+} @strong{::::+} @strong{--link}

@item @strong{:::+} @emph{arguments}
@anchor{@strong{:::+} @emph{arguments}}

Like @strong{:::} but linked like @strong{--link} to the previous input source.

Contrary to @strong{--link}, values do not wrap: The shortest input source
determines the length.

Example:

@verbatim
  parallel echo ::: a b c :::+ 1 2 3 ::: X Y :::+ 11 22
@end verbatim

See also: @strong{::::+} @strong{--link}

@item @strong{::::} @emph{argfiles}
@anchor{@strong{::::} @emph{argfiles}}

Another way to write @strong{--arg-file} @emph{argfile1} @strong{--arg-file} @emph{argfile2} ...

@strong{:::} and @strong{::::} can be mixed.

See also: @strong{--arg-file} @strong{:::} @strong{::::+} @strong{--link}

@item @strong{::::+} @emph{argfiles}
@anchor{@strong{::::+} @emph{argfiles}}

Like @strong{::::} but linked like @strong{--link} to the previous input source.

Contrary to @strong{--link}, values do not wrap: The shortest input source
determines the length.

See also: @strong{--arg-file} @strong{:::+} @strong{--link}

@item @strong{--null}
@anchor{@strong{--null}}

@item @strong{-0}
@anchor{@strong{-0}}

Use NUL as delimiter.

Normally input lines will end in \n (newline). If they end in \0
(NUL), then use this option. It is useful for processing arguments
that may contain \n (newline).

Shorthand for @strong{--delimiter '\0'}.

See also: @strong{--delimiter}

@item @strong{--arg-file} @emph{input-file}
@anchor{@strong{--arg-file} @emph{input-file}}

@item @strong{-a} @emph{input-file}
@anchor{@strong{-a} @emph{input-file}}

Use @emph{input-file} as input source.

If you use this option, stdin (standard input) is given to the first
process run.  Otherwise, stdin (standard input) is redirected from
/dev/null.

If multiple @strong{--arg-file} are given, each @emph{input-file} will be treated as an
input source, and all combinations of input sources will be
generated. E.g. The file @strong{foo} contains @strong{1 2}, the file
@strong{bar} contains @strong{a b c}.  @strong{-a foo} @strong{-a bar} will result in the combinations
(1,a) (1,b) (1,c) (2,a) (2,b) (2,c). This is useful for replacing
nested for-loops.

See also: @strong{--link} @strong{@{}@emph{n}@strong{@}} @strong{::::} @strong{::::+} @strong{:::}

@item @strong{--arg-file-sep} @emph{sep-str}
@anchor{@strong{--arg-file-sep} @emph{sep-str}}

Use @emph{sep-str} instead of @strong{::::} as separator string between command
and argument files.

Useful if @strong{::::} is used for something else by the command.

See also: @strong{::::}

@item @strong{--arg-sep} @emph{sep-str}
@anchor{@strong{--arg-sep} @emph{sep-str}}

Use @emph{sep-str} instead of @strong{:::} as separator string.

Useful if @strong{:::} is used for something else by the command.

Also useful if you command uses @strong{:::} but you still want to read
arguments from stdin (standard input): Simply change @strong{--arg-sep} to a
string that is not in the command line.

See also: @strong{:::}

@item @strong{--bar}
@anchor{@strong{--bar}}

Show progress as a progress bar.

In the bar is shown: % of jobs completed, estimated seconds left, and
number of jobs started.

It is compatible with @strong{zenity}:

@verbatim
  seq 1000 | parallel -j30 --bar '(echo {};sleep 0.1)' \
    2> >(perl -pe 'BEGIN{$/="\r";$|=1};s/\r/\n/g' |
         zenity --progress --auto-kill) | wc
@end verbatim

See also: @strong{--eta} @strong{--progress} @strong{--total-jobs}

@item @strong{--basefile} @emph{file}
@anchor{@strong{--basefile} @emph{file}}

@item @strong{--bf} @emph{file}
@anchor{@strong{--bf} @emph{file}}

@emph{file} will be transferred to each sshlogin before first job is
started.

It will be removed if @strong{--cleanup} is active. The file may be a script
to run or some common base data needed for the job.  Multiple
@strong{--bf} can be specified to transfer more basefiles. The @emph{file} will be
transferred the same way as @strong{--transferfile}.

See also: @strong{--sshlogin} @strong{--transfer} @strong{--return} @strong{--cleanup}
@strong{--workdir}

@item @strong{--basenamereplace} @emph{replace-str}
@anchor{@strong{--basenamereplace} @emph{replace-str}}

@item @strong{--bnr} @emph{replace-str}
@anchor{@strong{--bnr} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{/@}} for
basename of input line.

See also: @strong{@{/@}}

@item @strong{--basenameextensionreplace} @emph{replace-str}
@anchor{@strong{--basenameextensionreplace} @emph{replace-str}}

@item @strong{--bner} @emph{replace-str}
@anchor{@strong{--bner} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{/.@}} for basename of input line without extension.

See also: @strong{@{/.@}}

@item @strong{--bin} @emph{binexpr}
@anchor{@strong{--bin} @emph{binexpr}}

Use @emph{binexpr} as binning key and bin input to the jobs.

@emph{binexpr} is [column number|column name] [perlexpression] e.g.:

@verbatim
  3
  Address
  3 $_%=100
  Address s/\D//g
@end verbatim

Each input line is split using @strong{--colsep}. The value of the column is
put into $_, the perl expression is executed, the resulting value is
is the job slot that will be given the line. If the value is bigger
than the number of jobslots the value will be modulo number of jobslots.

This is similar to @strong{--shard} but the hashing algorithm is a simple
modulo, which makes it predictible which jobslot will receive which
value.

The performance is in the order of 100K rows per second. Faster if the
@emph{bincol} is small (<10), slower if it is big (>100).

@strong{--bin} requires @strong{--pipe} and a fixed numeric value for @strong{--jobs}.

See also: SPREADING BLOCKS OF DATA @strong{--group-by} @strong{--round-robin}
@strong{--shard}

@item @strong{--bg}
@anchor{@strong{--bg}}

Run command in background.

GNU @strong{parallel} will normally wait for the completion of a job. With
@strong{--bg} GNU @strong{parallel} will not wait for completion of the command
before exiting.

This is the default if @strong{--semaphore} is set.

Implies @strong{--semaphore}.

See also: @strong{--fg} @strong{man sem}

@item @strong{--bibtex}
@anchor{@strong{--bibtex}}

@item @strong{--citation}
@anchor{@strong{--citation}}

Print the citation notice and BibTeX entry for GNU @strong{parallel},
silence citation notice for all future runs, and exit. It will not run
any commands.

If it is impossible for you to run @strong{--citation} you can instead use
@strong{--will-cite}, which will run commands, but which will only silence
the citation notice for this single run.

If you use @strong{--will-cite} in scripts to be run by others you are
making it harder for others to see the citation notice.  The
development of GNU @strong{parallel} is indirectly financed through
citations, so if your users do not know they should cite then you are
making it harder to finance development. However, if you pay 10000
EUR, you have done your part to finance future development and should
feel free to use @strong{--will-cite} in scripts.

If you do not want to help financing future development by letting
other users see the citation notice or by paying, then please consider
using another tool instead of GNU @strong{parallel}. You can find some of
the alternatives in @strong{man parallel_alternatives}.

@item @strong{--block} @emph{size}
@anchor{@strong{--block} @emph{size}}

@item @strong{--block-size} @emph{size}
@anchor{@strong{--block-size} @emph{size}}

Size of block in bytes to read at a time.

The @emph{size} can be postfixed with K, M, G, T, P, k, m, g, t, or p.

GNU @strong{parallel} tries to meet the block size but can be off by the
length of one record. For performance reasons @emph{size} should be bigger
than a two records. GNU @strong{parallel} will warn you and automatically
increase the size if you choose a @emph{size} that is too small.

If you use @strong{-N}, @strong{--block} should be bigger than N+1 records.

@emph{size} defaults to 1M.

When using @strong{--pipe-part} a negative block size is not interpreted as a
blocksize but as the number of blocks each jobslot should have. So
this will run 10*5 = 50 jobs in total:

@verbatim
  parallel --pipe-part -a myfile --block -10 -j5 wc
@end verbatim

This is an efficient alternative to @strong{--round-robin} because data is
never read by GNU @strong{parallel}, but you can still have very few
jobslots process large amounts of data.

See also: UNIT PREFIX @strong{-N} @strong{--pipe} @strong{--pipe-part} @strong{--round-robin}
@strong{--block-timeout}

@item @strong{--block-timeout} @emph{duration}
@anchor{@strong{--block-timeout} @emph{duration}}

@item @strong{--bt} @emph{duration}
@anchor{@strong{--bt} @emph{duration}}

Timeout for reading block when using @strong{--pipe}.

If it takes longer than @emph{duration} to read a full block, use the
partial block read so far.

@emph{duration} is in seconds, but can be postfixed with s, m, h, or d.

See also: TIME POSTFIXES @strong{--pipe} @strong{--block}

@item @strong{--cat}
@anchor{@strong{--cat}}

Create a temporary file with content.

Normally @strong{--pipe}/@strong{--pipe-part} will give data to the program on
stdin (standard input). With @strong{--cat} GNU @strong{parallel} will create a
temporary file with the name in @strong{@{@}}, so you can do: @strong{parallel
--pipe --cat wc @{@}}.

Implies @strong{--pipe} unless @strong{--pipe-part} is used.

See also: @strong{--pipe} @strong{--pipe-part} @strong{--fifo}

@item @strong{--cleanup}
@anchor{@strong{--cleanup}}

Remove transferred files.

@strong{--cleanup} will remove the transferred files on the remote computer
after processing is done.

@verbatim
  find log -name '*gz' | parallel \
    --sshlogin server.example.com --transferfile {} \
    --return {.}.bz2 --cleanup "zcat {} | bzip -9 >{.}.bz2"
@end verbatim

With @strong{--transferfile @{@}} the file transferred to the remote computer
will be removed on the remote computer. Directories on the remote
computer containing the file will be removed if they are empty.

With @strong{--return} the file transferred from the remote computer will be
removed on the remote computer. Directories on the remote
computer containing the file will be removed if they are empty.

@strong{--cleanup} is ignored when not used with @strong{--basefile},
@strong{--transfer}, @strong{--transferfile} or @strong{--return}.

See also: @strong{--basefile} @strong{--transfer} @strong{--transferfile} @strong{--sshlogin}
@strong{--return}

@item @strong{--color}
@anchor{@strong{--color}}

Colour output.

Colour the output. Each job gets its own colour combination
(background+foreground).

@strong{--color} is ignored when using @strong{-u}.

See also: @strong{--color-failed}

@item @strong{--color-failed}
@anchor{@strong{--color-failed}}

@item @strong{--cf}
@anchor{@strong{--cf}}

Colour the output from failing jobs white on red.

Useful if you have a lot of jobs and want to focus on the failing
jobs.

@strong{--color-failed} is ignored when using @strong{-u}, @strong{--line-buffer} and
unreliable when using @strong{--latest-line}.

See also: @strong{--color}

@item @strong{--colsep} @emph{regexp}
@anchor{@strong{--colsep} @emph{regexp}}

@item @strong{-C} @emph{regexp}
@anchor{@strong{-C} @emph{regexp}}

Column separator.

The input will be treated as a table with @emph{regexp} separating the
columns. The n'th column can be accessed using @strong{@{}@emph{n}@strong{@}} or
@strong{@{}@emph{n}.@strong{@}}. E.g. @strong{@{3@}} is the 3rd column.

If there are more input sources, each input source will be separated,
but the columns from each input source will be linked.

@verbatim
  parallel --colsep '-' echo {4} {3} {2} {1} \
    ::: A-B C-D ::: e-f g-h
@end verbatim

@strong{--colsep} implies @strong{--trim rl}, which can be overridden with
@strong{--trim n}.

@emph{regexp} is a Perl Regular Expression:
https://perldoc.perl.org/perlre.html

See also: @strong{--csv} @strong{@{}@emph{n}@strong{@}} @strong{--trim} @strong{--link}

@item @strong{--compress}
@anchor{@strong{--compress}}

Compress temporary files.

If the output is big and very compressible this will take up less disk
space in $TMPDIR and possibly be faster due to less disk I/O.

GNU @strong{parallel} will try @strong{pzstd}, @strong{lbzip2}, @strong{pbzip2}, @strong{zstd},
@strong{pigz}, @strong{lz4}, @strong{lzop}, @strong{plzip}, @strong{lzip}, @strong{lrz}, @strong{gzip}, @strong{pxz},
@strong{lzma}, @strong{bzip2}, @strong{xz}, @strong{clzip}, in that order, and use the first
available.

GNU @strong{parallel} will use up to 8 processes per job waiting to be
printed. See @strong{man parallel_design} for details.

See also: @strong{--compress-program}

@item @strong{--compress-program} @emph{prg}
@anchor{@strong{--compress-program} @emph{prg}}

@item @strong{--decompress-program} @emph{prg}
@anchor{@strong{--decompress-program} @emph{prg}}

Use @emph{prg} for (de)compressing temporary files.

It is assumed that @emph{prg -dc} will decompress stdin (standard input)
to stdout (standard output) unless @strong{--decompress-program} is given.

See also: @strong{--compress}

@item @strong{--csv}
@anchor{@strong{--csv}}

Treat input as CSV-format.

@strong{--colsep} sets the field delimiter. It works very much like
@strong{--colsep} except it deals correctly with quoting. Compare:

@verbatim
   echo '"1 big, 2 small","2""x4"" plank",12.34' |
     parallel --csv echo {1} of {2} at {3}

   echo '"1 big, 2 small","2""x4"" plank",12.34' |
     parallel --colsep ',' echo {1} of {2} at {3}
@end verbatim

Even quoted newlines are parsed correctly:

@verbatim
   (echo '"Start of field 1 with newline'
    echo 'Line 2 in field 1";value 2') |
     parallel --csv --colsep ';' echo Field 1: {1} Field 2: {2}
@end verbatim

When used with @strong{--pipe} only pass full CSV-records.

See also: @strong{--pipe} @strong{--link} @strong{@{}@emph{n}@strong{@}} @strong{--colsep} @strong{--header}

@item @strong{--ctag} (obsolete: use @strong{--color} @strong{--tag})
@anchor{@strong{--ctag} (obsolete: use @strong{--color} @strong{--tag})}

Color tag.

If the values look very similar looking at the output it can be hard
to tell when a new value is used. @strong{--ctag} gives each value a random
color.

See also: @strong{--color} @strong{--tag}

@item @strong{--ctagstring} @emph{str} (obsolete: use @strong{--color} @strong{--tagstring})
@anchor{@strong{--ctagstring} @emph{str} (obsolete: use @strong{--color} @strong{--tagstring})}

Color tagstring.

See also: @strong{--color} @strong{--ctag} @strong{--tagstring}

@item @strong{--delay} @emph{duration}
@anchor{@strong{--delay} @emph{duration}}

Delay starting next job by @emph{duration}.

GNU @strong{parallel} will not start another job for the next @emph{duration}.

@emph{duration} is in seconds, but can be postfixed with s, m, h, or d.

If you append 'auto' to @emph{duration} (e.g. 13m3sauto) GNU @strong{parallel}
will automatically try to find the optimal value: If a job fails,
@emph{duration} is increased by 30%. If a job succeeds, @emph{duration} is
decreased by 10%.

See also: TIME POSTFIXES @strong{--retries} @strong{--ssh-delay}

@item @strong{--delimiter} @emph{delim}
@anchor{@strong{--delimiter} @emph{delim}}

@item @strong{-d} @emph{delim}
@anchor{@strong{-d} @emph{delim}}

Input items are terminated by @emph{delim}.

The specified delimiter may be characters, C-style character escapes
such as \n, or octal or hexadecimal escape codes.  Octal and
hexadecimal escape codes are understood as for the printf command.

See also: @strong{--colsep}

@item @strong{--dirnamereplace} @emph{replace-str}
@anchor{@strong{--dirnamereplace} @emph{replace-str}}

@item @strong{--dnr} @emph{replace-str}
@anchor{@strong{--dnr} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{//@}} for
dirname of input line.

See also: @strong{@{//@}}

@item @strong{--dry-run}
@anchor{@strong{--dry-run}}

Print the job to run on stdout (standard output), but do not run the
job.

Use @strong{-v -v} to include the wrapping that GNU @strong{parallel} generates
(for remote jobs, @strong{--tmux}, @strong{--nice}, @strong{--pipe}, @strong{--pipe-part},
@strong{--fifo} and @strong{--cat}). Do not count on this literally, though, as
the job may be scheduled on another computer or the local computer if
: is in the list.

See also: @strong{-v}

@item @strong{-E} @emph{eof-str}
@anchor{@strong{-E} @emph{eof-str}}

Set the end of file string to @emph{eof-str}.

If the end of file string occurs as a line of input, the rest of the
input is not read.  If neither @strong{-E} nor @strong{-e} is used, no end of file
string is used.

@item @strong{--eof}[=@emph{eof-str}]
@anchor{@strong{--eof}[=@emph{eof-str}]}

@item @strong{-e}[@emph{eof-str}]
@anchor{@strong{-e}[@emph{eof-str}]}

This option is a synonym for the @strong{-E} option.

Use @strong{-E} instead, because it is POSIX compliant for @strong{xargs} while
this option is not.  If @emph{eof-str} is omitted, there is no end of file
string.  If neither @strong{-E} nor @strong{-e} is used, no end of file string is
used.

@item @strong{--embed}
@anchor{@strong{--embed}}

Embed GNU @strong{parallel} in a shell script.

If you need to distribute your script to someone who does not want to
install GNU @strong{parallel} you can embed GNU @strong{parallel} in your own
shell script:

@verbatim
  parallel --embed > new_script
@end verbatim

After which you add your code at the end of @strong{new_script}. This is tested
on @strong{ash}, @strong{bash}, @strong{dash}, @strong{ksh}, @strong{sh}, and @strong{zsh}.

@item @strong{--env} @emph{var}
@anchor{@strong{--env} @emph{var}}

Copy exported environment variable @emph{var}.

This will copy @emph{var} to the environment that the command is run
in. This is especially useful for remote execution.

In Bash @emph{var} can also be a Bash function - just remember to @strong{export
-f} the function.

The variable '_' is special. It will copy all exported environment
variables except for the ones mentioned in ~/.parallel/ignored_vars.

To copy the full environment (both exported and not exported
variables, arrays, and functions) use @strong{env_parallel}.

See also: @strong{--record-env} @strong{--session} @strong{--sshlogin} @emph{command}
@strong{env_parallel}

@item @strong{--eta}
@anchor{@strong{--eta}}

Show the estimated number of seconds before finishing.

This forces GNU @strong{parallel} to read all jobs before starting to find
the number of jobs (unless you use @strong{--total-jobs}). GNU @strong{parallel}
normally only reads the next job to run.

The estimate is based on the runtime of finished jobs, so the first
estimate will only be shown when the first job has finished.

Implies @strong{--progress}.

See also: @strong{--bar} @strong{--progress} @strong{--total-jobs}

@item @strong{--fg}
@anchor{@strong{--fg}}

Run command in foreground.

With @strong{--tmux} and @strong{--tmuxpane} GNU @strong{parallel} will start @strong{tmux} in
the foreground.

With @strong{--semaphore} GNU @strong{parallel} will run the command in the
foreground (opposite @strong{--bg}), and wait for completion of the command
before exiting. Exit code will be that of the command.

See also: @strong{--bg} @strong{man sem}

@item @strong{--fifo}
@anchor{@strong{--fifo}}

Create a temporary fifo with content.

Normally @strong{--pipe} and @strong{--pipe-part} will give data to the program on
stdin (standard input). With @strong{--fifo} GNU @strong{parallel} will create a
temporary fifo with the name in @strong{@{@}}, so you can do:

@verbatim
  parallel --pipe --fifo wc {}
@end verbatim

Beware: If the fifo is never opened for reading, the job will block forever:

@verbatim
  seq 1000000 | parallel --fifo echo This will block forever
  seq 1000000 | parallel --fifo 'echo This will not block < {}'
@end verbatim

By using @strong{--fifo} instead of @strong{--cat} you may save I/O as @strong{--cat}
will write to a temporary file, whereas @strong{--fifo} will not.

Implies @strong{--pipe} unless @strong{--pipe-part} is used.

See also: @strong{--cat} @strong{--pipe} @strong{--pipe-part}

@item @strong{--filter} @emph{filter}
@anchor{@strong{--filter} @emph{filter}}

Only run jobs where @emph{filter} is true.

@emph{filter} can contain replacement strings and Perl code. Example:

@verbatim
  parallel --filter '{1}+{2}+{3} < 10' echo {1},{2},{3} \
    ::: {1..10} ::: {3..8} ::: {3..10}
@end verbatim

Outputs: 1,3,3 1,3,4 1,3,5 1,4,3 1,4,4 1,5,3 2,3,3 2,3,4 2,4,3 3,3,3

@verbatim
  parallel --filter '{1} < {2}*{2}' echo {1},{2} \
    ::: {1..10} ::: {1..3}
@end verbatim

Outputs: 1,2 1,3 2,2 2,3 3,2 3,3 4,3 5,3 6,3 7,3 8,3

@verbatim
  parallel --filter '{choose_k}' --plus echo {1},{2},{3} \
    ::: {1..5} ::: {1..5} ::: {1..5}
@end verbatim

Outputs: 1,2,3 1,2,4 1,2,5 1,3,4 1,3,5 1,4,5 2,3,4 2,3,5 2,4,5 3,4,5

See also: @strong{skip()} @strong{--no-run-if-empty} @strong{@{choose_k@}}

@item @strong{--filter-hosts}
@anchor{@strong{--filter-hosts}}

Remove down hosts.

For each remote host: check that login through ssh works. If not: do
not use this host.

For performance reasons, this check is performed only at the start and
every time @strong{--sshloginfile} is changed. If an host goes down after
the first check, it will go undetected until @strong{--sshloginfile} is
changed; @strong{--retries} can be used to mitigate this.

Currently you can @emph{not} put @strong{--filter-hosts} in a profile,
$PARALLEL, /etc/parallel/config or similar. This is because GNU
@strong{parallel} uses GNU @strong{parallel} to compute this, so you will get an
infinite loop. This will likely be fixed in a later release.

See also: @strong{--sshloginfile} @strong{--sshlogin} @strong{--retries}

@item @strong{--gnu}
@anchor{@strong{--gnu}}

Behave like GNU @strong{parallel}.

This option historically took precedence over @strong{--tollef}. The
@strong{--tollef} option is now retired, and therefore may not be
used. @strong{--gnu} is kept for compatibility, but does nothing.

@item @strong{--group}
@anchor{@strong{--group}}

Group output.

Output from each job is grouped together and is only printed when the
command is finished. Stdout (standard output) first followed by stderr
(standard error).

This takes in the order of 0.5ms CPU time per job and depends on the
speed of your disk for larger output.

@strong{--group} is the default.

See also: @strong{--line-buffer} @strong{--ungroup} @strong{--tag}

@item @strong{--group-by} @emph{val}
@anchor{@strong{--group-by} @emph{val}}

Group input by value.

Combined with @strong{--pipe}/@strong{--pipe-part} @strong{--group-by} groups lines with
the same value into a record.

The value can be computed from the full line or from a single column.

@emph{val} can be:

@table @asis
@item column number
@anchor{column number}

Use the value in the column numbered.

@item column name
@anchor{column name}

Treat the first line as a header and use the value in the column
named.

(Not supported with @strong{--pipe-part}).

@item perl expression
@anchor{perl expression}

Run the perl expression and use $_ as the value.

@item column number perl expression
@anchor{column number perl expression}

Put the value of the column put in $_, run the perl expression, and use $_ as the value.

@item column name perl expression
@anchor{column name perl expression}

Put the value of the column put in $_, run the perl expression, and use $_ as the value.

(Not supported with @strong{--pipe-part}).

@end table

Example:

@verbatim
  UserID, Consumption
  123,    1
  123,    2
  12-3,   1
  221,    3
  221,    1
  2/21,   5
@end verbatim

If you want to group 123, 12-3, 221, and 2/21 into 4 records and pass
one record at a time to @strong{wc}:

@verbatim
  tail -n +2 table.csv | \
    parallel --pipe --colsep , --group-by 1 -kN1 wc
@end verbatim

Make GNU @strong{parallel} treat the first line as a header:

@verbatim
  cat table.csv | \
    parallel --pipe --colsep , --header : --group-by 1 -kN1 wc
@end verbatim

Address column by column name:

@verbatim
  cat table.csv | \
    parallel --pipe --colsep , --header : --group-by UserID -kN1 wc
@end verbatim

If 12-3 and 123 are really the same UserID, remove non-digits in
UserID when grouping:

@verbatim
  cat table.csv | parallel --pipe --colsep , --header : \
    --group-by 'UserID s/\D//g' -kN1 wc
@end verbatim

See also: SPREADING BLOCKS OF DATA @strong{--pipe} @strong{--pipe-part} @strong{--bin}
@strong{--shard} @strong{--round-robin}

@item @strong{--help}
@anchor{@strong{--help}}

@item @strong{-h}
@anchor{@strong{-h}}

Print a summary of the options to GNU @strong{parallel} and exit.

@item @strong{--halt-on-error} @emph{val}
@anchor{@strong{--halt-on-error} @emph{val}}

@item @strong{--halt} @emph{val}
@anchor{@strong{--halt} @emph{val}}

When should GNU @strong{parallel} terminate?

In some situations it makes no sense to run all jobs. GNU
@strong{parallel} should simply stop as soon as a condition is met.

@emph{val} defaults to @strong{never}, which runs all jobs no matter what.

@emph{val} can also take on the form of @emph{when},@emph{why}.

@emph{when} can be 'now' which means kill all running jobs and halt
immediately, or it can be 'soon' which means wait for all running jobs
to complete, but start no new jobs.

@emph{why} can be 'fail=X', 'fail=Y%', 'success=X', 'success=Y%',
'done=X', or 'done=Y%' where X is the number of jobs that has to fail,
succeed, or be done before halting, and Y is the percentage of jobs
that has to fail, succeed, or be done before halting.

Example:

@table @asis
@item --halt now,fail=1
@anchor{--halt now@comma{}fail=1}

exit when a job has failed. Kill running jobs.

@item --halt soon,fail=3
@anchor{--halt soon@comma{}fail=3}

exit when 3 jobs have failed, but wait for running jobs to complete.

@item --halt soon,fail=3%
@anchor{--halt soon@comma{}fail=3%}

exit when 3% of the jobs have failed, but wait for running jobs to complete.

@item --halt now,success=1
@anchor{--halt now@comma{}success=1}

exit when a job has succeeded. Kill running jobs.

@item --halt soon,success=3
@anchor{--halt soon@comma{}success=3}

exit when 3 jobs have succeeded, but wait for running jobs to complete.

@item --halt now,success=3%
@anchor{--halt now@comma{}success=3%}

exit when 3% of the jobs have succeeded. Kill running jobs.

@item --halt now,done=1
@anchor{--halt now@comma{}done=1}

exit when a job has finished. Kill running jobs.

@item --halt soon,done=3
@anchor{--halt soon@comma{}done=3}

exit when 3 jobs have finished, but wait for running jobs to complete.

@item --halt now,done=3%
@anchor{--halt now@comma{}done=3%}

exit when 3% of the jobs have finished. Kill running jobs.

@end table

For backwards compatibility these also work:

@table @asis
@item 0
@anchor{0}

never

@item 1
@anchor{1}

soon,fail=1

@item 2
@anchor{2}

now,fail=1

@item -1
@anchor{-1}

soon,success=1

@item -2
@anchor{-2}

now,success=1

@item 1-99%
@anchor{1-99%}

soon,fail=1-99%

@end table

@item @strong{--header} @emph{regexp}
@anchor{@strong{--header} @emph{regexp}}

Use regexp as header.

For normal usage the matched header (typically the first line:
@strong{--header '.*\n'}) will be split using @strong{--colsep} (which will
default to '\t') and column names can be used as replacement
variables: @strong{@{column name@}}, @strong{@{column name/@}}, @strong{@{column name//@}},
@strong{@{column name/.@}}, @strong{@{column name.@}}, @strong{@{=column name perl expression
=@}}, ..

For @strong{--pipe} the matched header will be prepended to each output.

@strong{--header :} is an alias for @strong{--header '.*\n'}.

If @emph{regexp} is a number, it is a fixed number of lines.

@strong{--header 0} is special: It will make replacement strings for files
given with @strong{--arg-file} or @strong{::::}. It will make @strong{@{foo/bar@}} for the
file @strong{foo/bar}.

See also: @strong{--colsep} @strong{--pipe} @strong{--pipe-part} @strong{--arg-file}

@item @strong{--hostgroups}
@anchor{@strong{--hostgroups}}

@item @strong{--hgrp}
@anchor{@strong{--hgrp}}

Enable hostgroups on arguments.

If an argument contains '@@' the string after '@@' will be removed and
treated as a list of hostgroups on which this job is allowed to
run. If there is no @strong{--sshlogin} with a corresponding group, the job
will run on any hostgroup.

Example:

@verbatim
  parallel --hostgroups \
    --sshlogin @grp1/myserver1 -S @grp1+grp2/myserver2 \
    --sshlogin @grp3/myserver3 \
    echo ::: my_grp1_arg@grp1 arg_for_grp2@grp2 third@grp1+grp3
@end verbatim

@strong{my_grp1_arg} may be run on either @strong{myserver1} or @strong{myserver2},
@strong{third} may be run on either @strong{myserver1} or @strong{myserver3},
but @strong{arg_for_grp2} will only be run on @strong{myserver2}.

See also: @strong{--sshlogin} @strong{$PARALLEL_HOSTGROUPS} @strong{$PARALLEL_ARGHOSTGROUPS}

@item @strong{-I} @emph{replace-str}
@anchor{@strong{-I} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{@}}.

See also: @strong{@{@}}

@item @strong{--replace} [@emph{replace-str}]
@anchor{@strong{--replace} [@emph{replace-str}]}

@item @strong{-i} [@emph{replace-str}]
@anchor{@strong{-i} [@emph{replace-str}]}

This option is deprecated; use @strong{-I} instead.

This option is a synonym for @strong{-I}@emph{replace-str} if @emph{replace-str} is
specified, and for @strong{-I @{@}} otherwise.

See also: @strong{@{@}}

@item @strong{--joblog} @emph{logfile}
@anchor{@strong{--joblog} @emph{logfile}}

@item @strong{--jl} @emph{logfile}
@anchor{@strong{--jl} @emph{logfile}}

Logfile for executed jobs.

Save a list of the executed jobs to @emph{logfile} in the following TAB
separated format: sequence number, sshlogin, start time as seconds
since epoch, run time in seconds, bytes in files transferred, bytes in
files returned, exit status, signal, and command run.

For @strong{--pipe} bytes transferred and bytes returned are number of input
and output of bytes.

If @strong{logfile} is prepended with '+' log lines will be appended to the
logfile.

To convert the times into ISO-8601 strict do:

@verbatim
  cat logfile | perl -a -F"\t" -ne \
    'chomp($F[2]=`date -d \@$F[2] +%FT%T`); print join("\t",@F)'
@end verbatim

If the host is long, you can use @strong{column -t} to pretty print it:

@verbatim
  cat joblog | column -t
@end verbatim

See also: @strong{--resume} @strong{--resume-failed}

@item @strong{--jobs} @emph{num}
@anchor{@strong{--jobs} @emph{num}}

@item @strong{-j} @emph{num}
@anchor{@strong{-j} @emph{num}}

@item @strong{--max-procs} @emph{num}
@anchor{@strong{--max-procs} @emph{num}}

@item @strong{-P} @emph{num}
@anchor{@strong{-P} @emph{num}}

Number of jobslots on each machine.

Run up to @emph{num} jobs in parallel. Default is 100%.

@table @asis
@item @emph{num}
@anchor{@emph{num}}

Run up to @emph{num} jobs in parallel.

@item 0
@anchor{0 1}

Run as many as possible (this can take a while to determine).

Due to a bug @strong{-j 0} will also evaluate replacement strings twice up
to the number of joblots:

@verbatim
  # This will not count from 1 but from number-of-jobslots
  seq 10000 | parallel -j0   echo '{= $_ = $foo++; =}' | head
  # This will count from 1
  seq 10000 | parallel -j100 echo '{= $_ = $foo++; =}' | head
@end verbatim

@item @emph{num}%
@anchor{@emph{num}%}

Multiply the number of CPU threads by @emph{num} percent. E.g. 100% means
one job per CPU thread on each machine.

@item +@emph{num}
@anchor{+@emph{num}}

Add @emph{num} to the number of CPU threads.

@item -@emph{num}
@anchor{-@emph{num}}

Subtract @emph{num} from the number of CPU threads.

@item @emph{expr}
@anchor{@emph{expr}}

Evaluate @emph{expr}. E.g. '12/2' to get 6, '+25%' gives the same as
'125%', or complex expressions like '+3*log(55)%' which means:
multiply 3 by log(55), multiply that by the number of CPU threads and
divide by 100, add this to the number of CPU threads.

@item @emph{procfile}
@anchor{@emph{procfile}}

Read parameter from file.

Use the content of @emph{procfile} as parameter for
@emph{-j}. E.g. @emph{procfile} could contain the string 100% or +2 or 10.

If @emph{procfile} is changed when a job completes, @emph{procfile} is read
again and the new number of jobs is computed. If the number is lower
than before, running jobs will be allowed to finish but new jobs will
not be started until the wanted number of jobs has been reached.  This
makes it possible to change the number of simultaneous running jobs
while GNU @strong{parallel} is running.

@end table

If the evaluated number is less than 1 then 1 will be used.

If @strong{--semaphore} is set, the default is 1 thus making a mutex.

See also: @strong{--use-cores-instead-of-threads}
@strong{--use-sockets-instead-of-threads}

@item @strong{--keep-order}
@anchor{@strong{--keep-order}}

@item @strong{-k}
@anchor{@strong{-k}}

Keep sequence of output same as the order of input.

Normally the output of a job will be printed as soon as the job
completes. Try this to see the difference:

@verbatim
  parallel -j4 sleep {}\; echo {} ::: 2 1 4 3
  parallel -j4 -k sleep {}\; echo {} ::: 2 1 4 3
@end verbatim

If used with @strong{--onall} or @strong{--nonall} the output will grouped by
sshlogin in sorted order.

@strong{--keep-order} cannot keep the output order when used with @strong{--pipe
--round-robin}. Here it instead means, that the jobslots will get the
same blocks as input in the same order in every run if the input is
kept the same. Run each of these twice and compare:

@verbatim
  seq 10000000 | parallel --pipe --round-robin 'sleep 0.$RANDOM; wc'
  seq 10000000 | parallel --pipe -k --round-robin 'sleep 0.$RANDOM; wc'
@end verbatim

@strong{-k} only affects the order in which the output is printed - not the
order in which jobs are run.

See also: @strong{--group} @strong{--line-buffer}

@item @strong{-L} @emph{recsize}
@anchor{@strong{-L} @emph{recsize}}

When used with @strong{--pipe}: Read records of @emph{recsize}.

When used otherwise: Use at most @emph{recsize} nonblank input lines per
command line.  Trailing blanks cause an input line to be logically
continued on the next input line.

@strong{-L 0} means read one line, but insert 0 arguments on the command
line.

@emph{recsize} can be postfixed with K, M, G, T, P, k, m, g, t, or p.

Implies @strong{-X} unless @strong{-m}, @strong{--xargs}, or @strong{--pipe} is set.

See also: UNIT PREFIX @strong{-N} @strong{--max-lines} @strong{--block} @strong{-X} @strong{-m}
@strong{--xargs} @strong{--pipe}

@item @strong{--max-lines} [@emph{recsize}]
@anchor{@strong{--max-lines} [@emph{recsize}]}

@item @strong{-l}[@emph{recsize}]
@anchor{@strong{-l}[@emph{recsize}]}

When used with @strong{--pipe}: Read records of @emph{recsize} lines.

When used otherwise: Synonym for the @strong{-L} option.  Unlike @strong{-L}, the
@emph{recsize} argument is optional.  If @emph{recsize} is not specified,
it defaults to one.  The @strong{-l} option is deprecated since the POSIX
standard specifies @strong{-L} instead.

@strong{-l 0} is an alias for @strong{-l 1}.

Implies @strong{-X} unless @strong{-m}, @strong{--xargs}, or @strong{--pipe} is set.

See also: UNIT PREFIX @strong{-N} @strong{--block} @strong{-X} @strong{-m}
@strong{--xargs} @strong{--pipe}

@item @strong{--limit} "@emph{command} @emph{args}"
@anchor{@strong{--limit} "@emph{command} @emph{args}"}

Dynamic job limit.

Before starting a new job run @emph{command} with @emph{args}. The exit value
of @emph{command} determines what GNU @strong{parallel} will do:

@table @asis
@item 0
@anchor{0 2}

Below limit. Start another job.

@item 1
@anchor{1 1}

Over limit. Start no jobs.

@item 2
@anchor{2 1}

Way over limit. Kill the youngest job.

@end table

You can use any shell command. There are 3 predefined commands:

@table @asis
@item "io @emph{n}"
@anchor{"io @emph{n}"}

Limit for I/O. The amount of disk I/O will be computed as a value
0-100, where 0 is no I/O and 100 is at least one disk is 100%
saturated.

@item "load @emph{n}"
@anchor{"load @emph{n}"}

Similar to @strong{--load}.

@item "mem @emph{n}"
@anchor{"mem @emph{n}"}

Similar to @strong{--memfree}.

@end table

See also: @strong{--memfree} @strong{--load}

@item @strong{--latest-line}
@anchor{@strong{--latest-line}}

@item @strong{--ll}
@anchor{@strong{--ll}}

Print the lastest line. Each job gets a single line that is updated
with the lastest output from the job.

Example:

@verbatim
  slow_seq() {
    seq "$@" |
      perl -ne '$|=1; for(split//){ print; select($a,$a,$a,0.03);}'
  }
  export -f slow_seq
  parallel --shuf -j99 --ll --tag --bar --color slow_seq {} ::: {1..300}
@end verbatim

See also: @strong{--line-buffer}

@item @strong{--line-buffer}
@anchor{@strong{--line-buffer}}

@item @strong{--lb}
@anchor{@strong{--lb}}

Buffer output on line basis.

@strong{--group} will keep the output together for a whole job. @strong{--ungroup}
allows output to mixup with half a line coming from one job and half a
line coming from another job. @strong{--line-buffer} fits between these two:
GNU @strong{parallel} will print a full line, but will allow for mixing
lines of different jobs.

@strong{--line-buffer} takes more CPU power than both @strong{--group} and
@strong{--ungroup}, but can be much faster than @strong{--group} if the CPU is not
the limiting factor.

Normally @strong{--line-buffer} does not buffer on disk, and can thus
process an infinite amount of data, but it will buffer on disk when
combined with: @strong{--keep-order}, @strong{--results}, @strong{--compress}, and
@strong{--files}. This will make it as slow as @strong{--group} and will limit
output to the available disk space.

With @strong{--keep-order} @strong{--line-buffer} will output lines from the first
job continuously while it is running, then lines from the second job
while that is running. It will buffer full lines, but jobs will not
mix. Compare:

@verbatim
  parallel -j0 'echo [{};sleep {};echo {}]' ::: 1 3 2 4
  parallel -j0 --lb 'echo [{};sleep {};echo {}]' ::: 1 3 2 4
  parallel -j0 -k --lb 'echo [{};sleep {};echo {}]' ::: 1 3 2 4
@end verbatim

See also: @strong{--group} @strong{--ungroup} @strong{--keep-order} @strong{--tag}

@item @strong{--link}
@anchor{@strong{--link}}

@item @strong{--xapply}
@anchor{@strong{--xapply}}

Link input sources.

Read multiple input sources like the command @strong{xapply}. If multiple
input sources are given, one argument will be read from each of the
input sources. The arguments can be accessed in the command as @strong{@{1@}}
.. @strong{@{}@emph{n}@strong{@}}, so @strong{@{1@}} will be a line from the first input source,
and @strong{@{6@}} will refer to the line with the same line number from the
6th input source.

Compare these two:

@verbatim
  parallel echo {1} {2} ::: 1 2 3 ::: a b c
  parallel --link echo {1} {2} ::: 1 2 3 ::: a b c
@end verbatim

Arguments will be recycled if one input source has more arguments than the others:

@verbatim
  parallel --link echo {1} {2} {3} \
    ::: 1 2 ::: I II III ::: a b c d e f g
@end verbatim

See also: @strong{--header} @strong{:::+} @strong{::::+}

@item @strong{--load} @emph{max-load}
@anchor{@strong{--load} @emph{max-load}}

Only start jobs if load is less than max-load.

Do not start new jobs on a given computer unless the number of running
processes on the computer is less than @emph{max-load}. @emph{max-load} uses
the same syntax as @strong{--jobs}, so @emph{100%} for one per CPU is a valid
setting. Only difference is 0 which is interpreted as 0.01.

See also: @strong{--limit} @strong{--jobs}

@item @strong{--controlmaster}
@anchor{@strong{--controlmaster}}

@item @strong{-M}
@anchor{@strong{-M}}

Use ssh's ControlMaster to make ssh connections faster.

Useful if jobs run remote and are very fast to run. This is disabled
for sshlogins that specify their own ssh command.

See also: @strong{--ssh} @strong{--sshlogin}

@item @strong{-m}
@anchor{@strong{-m}}

Multiple arguments.

Insert as many arguments as the command line length permits. If
multiple jobs are being run in parallel: distribute the arguments
evenly among the jobs. Use @strong{-j1} or @strong{--xargs} to avoid this.

If @strong{@{@}} is not used the arguments will be appended to the
line.  If @strong{@{@}} is used multiple times each @strong{@{@}} will be replaced
with all the arguments.

Support for @strong{-m} with @strong{--sshlogin} is limited and may fail.

If in doubt use @strong{-X} as that will most likely do what is needed.

See also: @strong{-X} @strong{--xargs}

@item @strong{--memfree} @emph{size}
@anchor{@strong{--memfree} @emph{size}}

Minimum memory free when starting another job.

The @emph{size} can be postfixed with K, M, G, T, P, k, m, g, t, or p.

If the jobs take up very different amount of RAM, GNU @strong{parallel} will
only start as many as there is memory for. If less than @emph{size} bytes
are free, no more jobs will be started. If less than 50% @emph{size} bytes
are free, the youngest job will be killed (as per @strong{--term-seq}), and
put back on the queue to be run later.

@strong{--retries} must be set to determine how many times GNU @strong{parallel}
should retry a given job.

See also: UNIT PREFIX @strong{--term-seq} @strong{--retries} @strong{--memsuspend}

@item @strong{--memsuspend} @emph{size}
@anchor{@strong{--memsuspend} @emph{size}}

Suspend jobs when there is less memory available.

If the available memory falls below 2 * @emph{size}, GNU @strong{parallel} will
suspend some of the running jobs. If the available memory falls below
@emph{size}, only one job will be running.

If a single job takes up at most @emph{size} RAM, all jobs will complete
without running out of memory. If you have swap available, you can
usually lower @emph{size} to around half the size of a single job - with
the slight risk of swapping a little.

Jobs will be resumed when more RAM is available - typically when the
oldest job completes.

@strong{--memsuspend} only works on local jobs because there is no obvious
way to suspend remote jobs.

@emph{size} can be postfixed with K, M, G, T, P, k, m, g, t, or p.

See also: UNIT PREFIX @strong{--memfree}

@item @strong{--minversion} @emph{version}
@anchor{@strong{--minversion} @emph{version}}

Print the version GNU @strong{parallel} and exit.

If the current version of GNU @strong{parallel} is less than @emph{version} the
exit code is 255. Otherwise it is 0.

This is useful for scripts that depend on features only available from
a certain version of GNU @strong{parallel}:

@verbatim
   parallel --minversion 20170422 &&
     echo halt done=50% supported from version 20170422 &&
     parallel --halt now,done=50% echo ::: {1..100}
@end verbatim

See also: @strong{--version}

@item @strong{--max-args} @emph{max-args}
@anchor{@strong{--max-args} @emph{max-args}}

@item @strong{-n} @emph{max-args}
@anchor{@strong{-n} @emph{max-args}}

Use at most @emph{max-args} arguments per command line.

Fewer than @emph{max-args} arguments will be used if the size (see the
@strong{-s} option) is exceeded, unless the @strong{-x} option is given, in which
case GNU @strong{parallel} will exit.

@strong{-n 0} means read one argument, but insert 0 arguments on the command
line.

@emph{max-args} can be postfixed with K, M, G, T, P, k, m, g, t, or p (see
UNIT PREFIX).

Implies @strong{-X} unless @strong{-m} is set.

See also: @strong{-X} @strong{-m} @strong{--xargs} @strong{--max-replace-args}

@item @strong{--max-replace-args} @emph{max-args}
@anchor{@strong{--max-replace-args} @emph{max-args}}

@item @strong{-N} @emph{max-args}
@anchor{@strong{-N} @emph{max-args}}

Use at most @emph{max-args} arguments per command line.

Like @strong{-n} but also makes replacement strings @strong{@{1@}}
.. @strong{@{}@emph{max-args}@strong{@}} that represents argument 1 .. @emph{max-args}. If
too few args the @strong{@{}@emph{n}@strong{@}} will be empty.

@strong{-N 0} means read one argument, but insert 0 arguments on the command
line.

This will set the owner of the homedir to the user:

@verbatim
  tr ':' '\n' < /etc/passwd | parallel -N7 chown {1} {6}
@end verbatim

Implies @strong{-X} unless @strong{-m} or @strong{--pipe} is set.

@emph{max-args} can be postfixed with K, M, G, T, P, k, m, g, t, or p.

When used with @strong{--pipe} @strong{-N} is the number of records to read. This
is somewhat slower than @strong{--block}.

See also: UNIT PREFIX @strong{--pipe} @strong{--block} @strong{-m} @strong{-X} @strong{--max-args}

@item @strong{--nonall}
@anchor{@strong{--nonall}}

@strong{--onall} with no arguments.

Run the command on all computers given with @strong{--sshlogin} but take no
arguments. GNU @strong{parallel} will log into @strong{--jobs} number of computers
in parallel and run the job on the computer. @strong{-j} adjusts how many
computers to log into in parallel.

This is useful for running the same command (e.g. uptime) on a list of
servers.

See also: @strong{--onall} @strong{--sshlogin}

@item @strong{--onall}
@anchor{@strong{--onall}}

Run all the jobs on all computers given with @strong{--sshlogin}.

GNU @strong{parallel} will log into @strong{--jobs} number of computers in
parallel and run one job at a time on the computer. The order of the
jobs will not be changed, but some computers may finish before others.

When using @strong{--group} the output will be grouped by each server, so
all the output from one server will be grouped together.

@strong{--joblog} will contain an entry for each job on each server, so
there will be several job sequence 1.

See also: @strong{--nonall} @strong{--sshlogin}

@item @strong{--open-tty}
@anchor{@strong{--open-tty}}

@item @strong{-o}
@anchor{@strong{-o}}

Open terminal tty.

Similar to @strong{--tty} but does not set @strong{--jobs} or @strong{--ungroup}.

See also: @strong{--tty}

@item @strong{--output-as-files}
@anchor{@strong{--output-as-files}}

@item @strong{--outputasfiles}
@anchor{@strong{--outputasfiles}}

@item @strong{--files}
@anchor{@strong{--files}}

@item @strong{--files0}
@anchor{@strong{--files0}}

Save output to files.

Instead of printing the output to stdout (standard output) the output
of each job is saved in a file and the filename is then printed.

@strong{--files0} uses NUL (\0) instead of newline (\n) as separator.

See also: @strong{--results}

@item @strong{--pipe}
@anchor{@strong{--pipe}}

@item @strong{--spreadstdin}
@anchor{@strong{--spreadstdin}}

Spread input to jobs on stdin (standard input).

Read a block of data from stdin (standard input) and give one block of
data as input to one job.

The block size is determined by @strong{--block} (default: 1M).

Except for the first and last record GNU @strong{parallel} only passes full
records to the job. The strings @strong{--recstart} and @strong{--recend}
determine where a record starts and ends: The border between two
records is defined as @strong{--recend} immediately followed by
@strong{--recstart}. GNU @strong{parallel} splits exactly after @strong{--recend} and
before @strong{--recstart}. The block will have the last partial record
removed before the block is passed on to the job. The partial record
will be prepended to next block.

You can limit the number of records to be passed with @strong{-N}, and set
the record size with @strong{-L}.

@strong{--pipe} maxes out at around 1 GB/s input, and 100 MB/s output. If
performance is important use @strong{--pipe-part}.

@strong{--fifo} and @strong{--cat} will give stdin (standard input) on a fifo or a
temporary file.

If data is arriving slowly, you can use @strong{--block-timeout} to finish
reading a block early.

The data can be spread between the jobs in specific ways using
@strong{--round-robin}, @strong{--bin}, @strong{--shard}, @strong{--group-by}. See the
section: SPREADING BLOCKS OF DATA

See also: @strong{--block} @strong{--block-timeout} @strong{--recstart} @strong{--recend}
@strong{--fifo} @strong{--cat} @strong{--pipe-part} @strong{-N} @strong{-L} @strong{--round-robin}

@item @strong{--pipe-part}
@anchor{@strong{--pipe-part}}

Pipe parts of a physical file.

@strong{--pipe-part} works similar to @strong{--pipe}, but is much faster. 5 GB/s
can easily be delivered.

@strong{--pipe-part} has a few limitations:

@itemize
@item The file must be a normal file or a block device (technically it must
be seekable) and must be given using @strong{--arg-file} or @strong{::::}. The file cannot
be a pipe, a fifo, or a stream as they are not seekable.

If using a block device with lot of NUL bytes, remember to set
@strong{--recend ''}.

@item Record counting (@strong{-N}) and line counting (@strong{-L}/@strong{-l}) do not
work. Instead use @strong{--recstart} and @strong{--recend} to determine
where records end.

@end itemize

See also: @strong{--pipe} @strong{--recstart} @strong{--recend} @strong{--arg-file} @strong{::::}

@item @strong{--plain}
@anchor{@strong{--plain}}

Ignore @strong{--profile}, $PARALLEL, and ~/.parallel/config.

Ignore any @strong{--profile}, $PARALLEL, and ~/.parallel/config to get full
control on the command line (used by GNU @strong{parallel} internally when
called with @strong{--sshlogin}).

See also: @strong{--profile}

@item @strong{--plus}
@anchor{@strong{--plus}}

Add more replacement strings.

Activate additional replacement strings: @{+/@} @{+.@} @{+..@} @{+...@} @{..@}
@{...@} @{/..@} @{/...@} @{##@}. The idea being that '@{+foo@}' matches the
opposite of '@{foo@}' so that:

@{@} = @{+/@}/@{/@} = @{.@}.@{+.@} = @{+/@}/@{/.@}.@{+.@}  = @{..@}.@{+..@} =
@{+/@}/@{/..@}.@{+..@} = @{...@}.@{+...@} = @{+/@}/@{/...@}.@{+...@}

@strong{@{##@}} is the total number of jobs to be run. It is incompatible with
@strong{-X}/@strong{-m}/@strong{--xargs}.

@strong{@{0%@}} zero-padded jobslot.

@strong{@{0#@}} zero-padded sequence number.

@strong{@{choose_k@}} is inspired by n choose k: Given a list of n elements,
choose k. k is the number of input sources and n is the number of
arguments in an input source.  The content of the input sources must
be the same and the arguments must be unique.

@strong{@{uniq@}} skips jobs where values from two input sources are the same.

Shorthands for variables:

@verbatim
  {slot}         $PARALLEL_JOBSLOT (see {%})
  {sshlogin}     $PARALLEL_SSHLOGIN
  {host}         $PARALLEL_SSHHOST
  {agrp}         $PARALLEL_ARGHOSTGROUPS
  {hgrp}         $PARALLEL_HOSTGROUPS
@end verbatim

The following dynamic replacement strings are also activated. They are
inspired by bash's parameter expansion:

@verbatim
  {:-str}        str if the value is empty
  {:num}         remove the first num characters
  {:pos:len}     substring from position pos length len
  {#regexp}      remove prefix regexp (non-greedy)
  {##regexp}     remove prefix regexp (greedy)
  {%regexp}      remove postfix regexp (non-greedy)
  {%%regexp}     remove postfix regexp (greedy)
  {/regexp/str}  replace one regexp with str
  {//regexp/str} replace every regexp with str
  {^str}         uppercase str if found at the start
  {^^str}        uppercase str
  {,str}         lowercase str if found at the start
  {,,str}        lowercase str
@end verbatim

See also: @strong{--rpl} @strong{@{@}}

@item @strong{--process-slot-var} @emph{varname}
@anchor{@strong{--process-slot-var} @emph{varname}}

Set the environment variable @emph{varname} to the jobslot number-1.

@verbatim
  seq 10 | parallel --process-slot-var=name echo '$name' {}
@end verbatim

@item @strong{--progress}
@anchor{@strong{--progress}}

Show progress of computations.

List the computers involved in the task with number of CPUs detected
and the max number of jobs to run. After that show progress for each
computer: number of running jobs, number of completed jobs, and
percentage of all jobs done by this computer. The percentage will only
be available after all jobs have been scheduled as GNU @strong{parallel}
only read the next job when ready to schedule it - this is to avoid
wasting time and memory by reading everything at startup.

By sending GNU @strong{parallel} SIGUSR2 you can toggle turning on/off
@strong{--progress} on a running GNU @strong{parallel} process.

See also: @strong{--eta} @strong{--bar}

@item @strong{--max-line-length-allowed}
@anchor{@strong{--max-line-length-allowed}}

Print maximal command line length.

Print the maximal number of characters allowed on the command line and
exit (used by GNU @strong{parallel} itself to determine the line length
on remote computers).

See also: @strong{--show-limits}

@item @strong{--number-of-cpus} (obsolete)
@anchor{@strong{--number-of-cpus} (obsolete)}

Print the number of physical CPU cores and exit.

@item @strong{--number-of-cores}
@anchor{@strong{--number-of-cores}}

Print the number of physical CPU cores and exit (used by GNU @strong{parallel} itself
to determine the number of physical CPU cores on remote computers).

See also: @strong{--number-of-sockets} @strong{--number-of-threads}
@strong{--use-cores-instead-of-threads} @strong{--jobs}

@item @strong{--number-of-sockets}
@anchor{@strong{--number-of-sockets}}

Print the number of filled CPU sockets and exit (used by GNU
@strong{parallel} itself to determine the number of filled CPU sockets on
remote computers).

See also: @strong{--number-of-cores} @strong{--number-of-threads}
@strong{--use-sockets-instead-of-threads} @strong{--jobs}

@item @strong{--number-of-threads}
@anchor{@strong{--number-of-threads}}

Print the number of hyperthreaded CPU cores and exit (used by GNU
@strong{parallel} itself to determine the number of hyperthreaded CPU cores
on remote computers).

See also: @strong{--number-of-cores} @strong{--number-of-sockets} @strong{--jobs}

@item @strong{--no-keep-order}
@anchor{@strong{--no-keep-order}}

Overrides an earlier @strong{--keep-order} (e.g. if set in
@strong{~/.parallel/config}).

@item @strong{--nice} @emph{niceness}
@anchor{@strong{--nice} @emph{niceness}}

Run the command at this niceness.

By default GNU @strong{parallel} will run jobs at the same nice level as GNU
@strong{parallel} is started - both on the local machine and remote servers,
so you are unlikely to ever use this option.

Setting @strong{--nice} will override this nice level. If the nice level is
smaller than the current nice level, it will only affect remote jobs
(e.g. if current level is 10 then @strong{--nice 5} will cause local jobs to
be run at level 10, but remote jobs run at nice level 5).

@item @strong{--interactive}
@anchor{@strong{--interactive}}

@item @strong{-p}
@anchor{@strong{-p}}

Ask user before running a job.

Prompt the user about whether to run each command line and read a line
from the terminal.  Only run the command line if the response starts
with 'y' or 'Y'.  Implies @strong{-t}.

@item @strong{--_parset} @emph{type},@emph{varname}
@anchor{@strong{--_parset} @emph{type}@comma{}@emph{varname}}

Used internally by @strong{parset}.

Generate shell code to be eval'ed which will set the variable(s)
@emph{varname}. @emph{type} can be 'assoc' for associative array or 'var' for
normal variables.

The only supported use is as part of @strong{parset}.

@item @strong{--parens} @emph{parensstring}
@anchor{@strong{--parens} @emph{parensstring}}

Use @emph{parensstring} instead of @strong{@{==@}}.

Define start and end parenthesis for @strong{@{=perl expression=@}}. The
left and the right parenthesis can be multiple characters and are
assumed to be the same length. The default is @strong{@{==@}} giving @strong{@{=} as
the start parenthesis and @strong{=@}} as the end parenthesis.

Another useful setting is @strong{,,,,} which would make both parenthesis
@strong{,,}:

@verbatim
  parallel --parens ,,,, echo foo is ,,s/I/O/g,, ::: FII
@end verbatim

See also: @strong{--rpl} @strong{@{=}@emph{perl expression}@strong{=@}}

@item @strong{--profile} @emph{profilename}
@anchor{@strong{--profile} @emph{profilename}}

@item @strong{-J} @emph{profilename}
@anchor{@strong{-J} @emph{profilename}}

Use profile @emph{profilename} for options.

This is useful if you want to have multiple profiles. You could have
one profile for running jobs in parallel on the local computer and a
different profile for running jobs on remote computers.

@emph{profilename} corresponds to the file ~/.parallel/@emph{profilename}.

You can give multiple profiles by repeating @strong{--profile}. If parts of
the profiles conflict, the later ones will be used.

Default: ~/.parallel/config

See also: PROFILE FILES

@item @strong{--quote}
@anchor{@strong{--quote}}

@item @strong{-q}
@anchor{@strong{-q}}

Quote @emph{command}.

If your command contains special characters that should not be
interpreted by the shell (e.g. ; \ | *), use @strong{--quote} to escape
these. The command must be a simple command (see @strong{man bash}) without
redirections and without variable assignments.

Most people will not need this. Quoting is disabled by default.

See also: QUOTING @emph{command} @strong{--shell-quote} @strong{uq()} @strong{Q()}

@item @strong{--no-run-if-empty}
@anchor{@strong{--no-run-if-empty}}

@item @strong{-r}
@anchor{@strong{-r}}

Do not run empty input.

If the stdin (standard input) only contains whitespace, do not run the
command.

If used with @strong{--pipe} this is slow.

See also: @emph{command} @strong{--pipe} @strong{--interactive}

@item @strong{--noswap}
@anchor{@strong{--noswap}}

Do not start job is computer is swapping.

Do not start new jobs on a given computer if there is both swap-in and
swap-out activity.

The swap activity is only sampled every 10 seconds as the sampling
takes 1 second to do.

Swap activity is computed as (swap-in)*(swap-out) which in practice is
a good value: swapping out is not a problem, swapping in is not a
problem, but both swapping in and out usually indicates a problem.

@strong{--memfree} and @strong{--memsuspend} may give better results, so try using
those first.

See also: @strong{--memfree} @strong{--memsuspend}

@item @strong{--record-env}
@anchor{@strong{--record-env}}

Record exported environment.

Record current exported environment variables in
@strong{~/.parallel/ignored_vars}.  This will ignore variables currently set
when using @strong{--env _}. So you should set the variables/fuctions, you
want to use @emph{after} running @strong{--record-env}.

See also: @strong{--env} @strong{--session} @strong{env_parallel}

@item @strong{--recstart} @emph{startstring}
@anchor{@strong{--recstart} @emph{startstring}}

@item @strong{--recend} @emph{endstring}
@anchor{@strong{--recend} @emph{endstring}}

Split record between @emph{endstring} and @emph{startstring}.

If @strong{--recstart} is given @emph{startstring} will be used to split at record start.

If @strong{--recend} is given @emph{endstring} will be used to split at record end.

If both @strong{--recstart} and @strong{--recend} are given the combined string
@emph{endstring}@emph{startstring} will have to match to find a split
position. This is useful if either @emph{startstring} or @emph{endstring}
match in the middle of a record.

If neither @strong{--recstart} nor @strong{--recend} are given, then @strong{--recend}
defaults to '\n'. To have no record separator (e.g. for binary files)
use @strong{--recend ""}.

@strong{--recstart} and @strong{--recend} are used with @strong{--pipe}.

Use @strong{--regexp} to interpret @strong{--recstart} and @strong{--recend} as regular
expressions. This is slow, however.

Use @strong{--remove-rec-sep} to remove @strong{--recstart} and @strong{--recend} before
passing the block to the job.

See also: @strong{--pipe} @strong{--regexp} @strong{--remove-rec-sep}

@item @strong{--regexp}
@anchor{@strong{--regexp}}

Use @strong{--regexp} to interpret @strong{--recstart} and @strong{--recend} as regular
expressions. This is slow, however.

See also: @strong{--pipe} @strong{--regexp} @strong{--remove-rec-sep} @strong{--recstart}
@strong{--recend}

@item @strong{--remove-rec-sep}
@anchor{@strong{--remove-rec-sep}}

@item @strong{--removerecsep}
@anchor{@strong{--removerecsep}}

@item @strong{--rrs}
@anchor{@strong{--rrs}}

Remove record separator.

Remove the text matched by @strong{--recstart} and @strong{--recend} before piping
it to the command.

Only used with @strong{--pipe}/@strong{--pipe-part}.

See also: @strong{--pipe} @strong{--regexp} @strong{--pipe-part} @strong{--recstart}
@strong{--recend}

@item @strong{--results} @emph{name}
@anchor{@strong{--results} @emph{name}}

@item @strong{--res} @emph{name}
@anchor{@strong{--res} @emph{name}}

Save the output into files.

@strong{Simple string output dir}

If @emph{name} does not contain replacement strings and does not end in
@strong{.csv/.tsv}, the output will be stored in a directory tree rooted at
@emph{name}.  Within this directory tree, each command will result in
three files: @emph{name}/<ARGS>/stdout and @emph{name}/<ARGS>/stderr,
@emph{name}/<ARGS>/seq, where <ARGS> is a sequence of directories
representing the header of the input source (if using @strong{--header :})
or the number of the input source and corresponding values.

E.g:

@verbatim
  parallel --header : --results foo echo {a} {b} \
    ::: a I II ::: b III IIII
@end verbatim

will generate the files:

@verbatim
  foo/a/II/b/III/seq
  foo/a/II/b/III/stderr
  foo/a/II/b/III/stdout
  foo/a/II/b/IIII/seq
  foo/a/II/b/IIII/stderr
  foo/a/II/b/IIII/stdout
  foo/a/I/b/III/seq
  foo/a/I/b/III/stderr
  foo/a/I/b/III/stdout
  foo/a/I/b/IIII/seq
  foo/a/I/b/IIII/stderr
  foo/a/I/b/IIII/stdout
@end verbatim

and

@verbatim
  parallel --results foo echo {1} {2} ::: I II ::: III IIII
@end verbatim

will generate the files:

@verbatim
  foo/1/II/2/III/seq
  foo/1/II/2/III/stderr
  foo/1/II/2/III/stdout
  foo/1/II/2/IIII/seq
  foo/1/II/2/IIII/stderr
  foo/1/II/2/IIII/stdout
  foo/1/I/2/III/seq
  foo/1/I/2/III/stderr
  foo/1/I/2/III/stdout
  foo/1/I/2/IIII/seq
  foo/1/I/2/IIII/stderr
  foo/1/I/2/IIII/stdout
@end verbatim

@strong{CSV file output}

If @emph{name} ends in @strong{.csv}/@strong{.tsv} the output will be a CSV-file
named @emph{name}.

@strong{.csv} gives a comma separated value file. @strong{.tsv} gives a TAB
separated value file.

@strong{-.csv}/@strong{-.tsv} are special: It will give the file on stdout
(standard output).

@strong{JSON file output}

If @emph{name} ends in @strong{.json} the output will be a JSON-file
named @emph{name}.

@strong{-.json} is special: It will give the file on stdout (standard
output).

@strong{Replacement string output file}

If @emph{name} contains a replacement string and the replaced result does
not end in /, then the standard output will be stored in a file named
by this result. Standard error will be stored in the same file name
with '.err' added, and the sequence number will be stored in the same
file name with '.seq' added.

E.g.

@verbatim
  parallel --results my_{} echo ::: foo bar baz
@end verbatim

will generate the files:

@verbatim
  my_bar
  my_bar.err
  my_bar.seq
  my_baz
  my_baz.err
  my_baz.seq
  my_foo
  my_foo.err
  my_foo.seq
@end verbatim

@strong{Replacement string output dir}

If @emph{name} contains a replacement string and the replaced result ends
in /, then output files will be stored in the resulting dir.

E.g.

@verbatim
  parallel --results my_{}/ echo ::: foo bar baz
@end verbatim

will generate the files:

@verbatim
  my_bar/seq
  my_bar/stderr
  my_bar/stdout
  my_baz/seq
  my_baz/stderr
  my_baz/stdout
  my_foo/seq
  my_foo/stderr
  my_foo/stdout
@end verbatim

See also: @strong{--output-as-files} @strong{--tag} @strong{--header} @strong{--joblog}

@item @strong{--resume}
@anchor{@strong{--resume}}

Resumes from the last unfinished job.

By reading @strong{--joblog} or the
@strong{--results} dir GNU @strong{parallel} will figure out the last unfinished
job and continue from there. As GNU @strong{parallel} only looks at the
sequence numbers in @strong{--joblog} then the input, the command, and
@strong{--joblog} all have to remain unchanged; otherwise GNU @strong{parallel}
may run wrong commands.

See also: @strong{--joblog} @strong{--results} @strong{--resume-failed} @strong{--retries}

@item @strong{--resume-failed}
@anchor{@strong{--resume-failed}}

Retry all failed and resume from the last unfinished job.

By reading
@strong{--joblog} GNU @strong{parallel} will figure out the failed jobs and run
those again. After that it will resume last unfinished job and
continue from there. As GNU @strong{parallel} only looks at the sequence
numbers in @strong{--joblog} then the input, the command, and @strong{--joblog}
all have to remain unchanged; otherwise GNU @strong{parallel} may run wrong
commands.

See also: @strong{--joblog} @strong{--resume} @strong{--retry-failed} @strong{--retries}

@item @strong{--retry-failed}
@anchor{@strong{--retry-failed}}

Retry all failed jobs in joblog.

By reading @strong{--joblog} GNU
@strong{parallel} will figure out the failed jobs and run those again.

@strong{--retry-failed} ignores the command and arguments on the command
line: It only looks at the joblog.

@strong{Differences between --resume, --resume-failed, --retry-failed}

In this example @strong{exit @{= $_%=2 =@}} will cause every other job to fail.

@verbatim
  timeout -k 1 4 parallel --joblog log -j10 \
    'sleep {}; exit {= $_%=2 =}' ::: {10..1}
@end verbatim

4 jobs completed. 2 failed:

@verbatim
  Seq   [...]   Exitval Signal  Command
  10    [...]   1       0       sleep 1; exit 1
  9     [...]   0       0       sleep 2; exit 0
  8     [...]   1       0       sleep 3; exit 1
  7     [...]   0       0       sleep 4; exit 0
@end verbatim

@strong{--resume} does not care about the Exitval, but only looks at Seq. If
the Seq is run, it will not be run again. So if needed, you can change
the command for the seqs not run yet:

@verbatim
  parallel --resume --joblog log -j10 \
    'sleep .{}; exit {= $_%=2 =}' ::: {10..1}

  Seq   [...]   Exitval Signal  Command
  [... as above ...]
  1     [...]   0       0       sleep .10; exit 0
  6     [...]   1       0       sleep .5; exit 1
  5     [...]   0       0       sleep .6; exit 0
  4     [...]   1       0       sleep .7; exit 1
  3     [...]   0       0       sleep .8; exit 0
  2     [...]   1       0       sleep .9; exit 1
@end verbatim

@strong{--resume-failed} cares about the Exitval, but also only looks at Seq
to figure out which commands to run. Again this means you can change
the command, but not the arguments. It will run the failed seqs and
the seqs not yet run:

@verbatim
  parallel --resume-failed --joblog log -j10 \
    'echo {};sleep .{}; exit {= $_%=3 =}' ::: {10..1}

  Seq   [...]   Exitval Signal  Command
  [... as above ...]
  10    [...]   1       0       echo 1;sleep .1; exit 1
  8     [...]   0       0       echo 3;sleep .3; exit 0
  6     [...]   2       0       echo 5;sleep .5; exit 2
  4     [...]   1       0       echo 7;sleep .7; exit 1
  2     [...]   0       0       echo 9;sleep .9; exit 0
@end verbatim

@strong{--retry-failed} cares about the Exitval, but takes the command from
the joblog. It ignores any arguments or commands given on the command
line:

@verbatim
  parallel --retry-failed --joblog log -j10 this part is ignored

  Seq   [...]   Exitval Signal  Command
  [... as above ...]
  10    [...]   1       0       echo 1;sleep .1; exit 1
  6     [...]   2       0       echo 5;sleep .5; exit 2
  4     [...]   1       0       echo 7;sleep .7; exit 1
@end verbatim

See also: @strong{--joblog} @strong{--resume} @strong{--resume-failed} @strong{--retries}

@item @strong{--retries} @emph{n}
@anchor{@strong{--retries} @emph{n}}

Try failing jobs @emph{n} times.

If a job fails, retry it on another computer on which it has not
failed. Do this @emph{n} times. If there are fewer than @emph{n} computers in
@strong{--sshlogin} GNU @strong{parallel} will re-use all the computers. This is
useful if some jobs fail for no apparent reason (such as network
failure).

@emph{n}=0 means infinite.

See also: @strong{--term-seq} @strong{--sshlogin}

@item @strong{--return} @emph{filename}
@anchor{@strong{--return} @emph{filename}}

Transfer files from remote computers.

@strong{--return} is used with
@strong{--sshlogin} when the arguments are files on the remote computers. When
processing is done the file @emph{filename} will be transferred
from the remote computer using @strong{rsync} and will be put relative to
the default login dir. E.g.

@verbatim
  echo foo/bar.txt | parallel --return {.}.out \
    --sshlogin server.example.com touch {.}.out
@end verbatim

This will transfer the file @emph{$HOME/foo/bar.out} from the computer
@emph{server.example.com} to the file @emph{foo/bar.out} after running
@strong{touch foo/bar.out} on @emph{server.example.com}.

@verbatim
  parallel -S server --trc out/./{}.out touch {}.out ::: in/file
@end verbatim

This will transfer the file @emph{in/file.out} from the computer
@emph{server.example.com} to the files @emph{out/in/file.out} after running
@strong{touch in/file.out} on @emph{server}.

@verbatim
  echo /tmp/foo/bar.txt | parallel --return {.}.out \
    --sshlogin server.example.com touch {.}.out
@end verbatim

This will transfer the file @emph{/tmp/foo/bar.out} from the computer
@emph{server.example.com} to the file @emph{/tmp/foo/bar.out} after running
@strong{touch /tmp/foo/bar.out} on @emph{server.example.com}.

Multiple files can be transferred by repeating the option multiple
times:

@verbatim
  echo /tmp/foo/bar.txt | parallel \
    --sshlogin server.example.com \
    --return {.}.out --return {.}.out2 touch {.}.out {.}.out2
@end verbatim

@strong{--return} is ignored when used with @strong{--sshlogin :} or when not used
with @strong{--sshlogin}.

For details on transferring see @strong{--transferfile}.

See also: @strong{--transfer} @strong{--transferfile} @strong{--sshlogin} @strong{--cleanup}
@strong{--workdir}

@item @strong{--round-robin}
@anchor{@strong{--round-robin}}

@item @strong{--round}
@anchor{@strong{--round}}

Distribute chunks of standard input in a round robin fashion.

Normally @strong{--pipe} will give a single block to each instance of the
command. With @strong{--round-robin} all blocks will at random be written to
commands already running. This is useful if the command takes a long
time to initialize.

With @strong{--keep-order} and @strong{--round-robin} the jobslots will get the
same blocks as input in the same order in every run if the input is
kept the same. See details under @strong{--keep-order}.

@strong{--round-robin} implies @strong{--pipe}, except if @strong{--pipe-part} is given.

See the section: SPREADING BLOCKS OF DATA.

See also: @strong{--bin} @strong{--group-by} @strong{--shard}

@item @strong{--rpl} '@emph{tag} @emph{perl expression}'
@anchor{@strong{--rpl} '@emph{tag} @emph{perl expression}'}

Define replacement string.

Use @emph{tag} as a replacement string for @emph{perl expression}. This makes
it possible to define your own replacement strings. GNU @strong{parallel}'s
7 replacement strings are implemented as:

@verbatim
  --rpl '{} '
  --rpl '{#} 1 $_=$job->seq()'
  --rpl '{%} 1 $_=$job->slot()'
  --rpl '{/} s:.*/::'
  --rpl '{//} $Global::use{"File::Basename"} ||=
              eval "use File::Basename; 1;"; $_ = dirname($_);'
  --rpl '{/.} s:.*/::; s:\.[^/.]+$::;'
  --rpl '{.} s:\.[^/.]+$::'
@end verbatim

The @strong{--plus} replacement strings are implemented as:

@verbatim
  --rpl '{+/} s:/[^/]*$:: || s:.*$::'
  --rpl '{+.} s:.*\.:: || s:.*$::'
  --rpl '{+..} s:.*\.([^/.]+\.[^/.]+)$:$1: || s:.*$::'
  --rpl '{+...} s:.*\.([^/.]+\.[^/.]+\.[^/.]+)$:$1: || s:.*$::'
  --rpl '{..} s:\.[^/.]+\.[^/.]+$::'
  --rpl '{...} s:\.[^/.]+\.[^/.]+\.[^/.]+$::'
  --rpl '{/..} s:.*/::; s:\.[^/.]+\.[^/.]+$::'
  --rpl '{/...} s:.*/::; s:\.[^/.]+\.[^/.]+\.[^/.]+$::'
  --rpl '{choose_k}
         for $t (2..$#arg){ if($arg[$t-1] ge $arg[$t]) { skip() } }'
  --rpl '{##} 1 $_=total_jobs()'
  --rpl '{0%} 1 $f=1+int((log($Global::max_jobs_running||1)/
                          log(10))); $_=sprintf("%0${f}d",slot())'
  --rpl '{0#} 1 $f=1+int((log(total_jobs())/log(10)));
              $_=sprintf("%0${f}d",seq())'

  --rpl '{:-([^}]+?)} $_ ||= $$1'
  --rpl '{:(\d+?)} substr($_,0,$$1) = ""'
  --rpl '{:(\d+?):(\d+?)} $_ = substr($_,$$1,$$2);'
  --rpl '{#([^#}][^}]*?)} $nongreedy=::make_regexp_ungreedy($$1);
                          s/^$nongreedy(.*)/$1/;'
  --rpl '{##([^#}][^}]*?)} s/^$$1//;'
  --rpl '{%([^}]+?)} $nongreedy=::make_regexp_ungreedy($$1);
                     s/(.*)$nongreedy$/$1/;'
  --rpl '{%%([^}]+?)} s/$$1$//;'
  --rpl '{/([^}]+?)/([^}]*?)} s/$$1/$$2/;'
  --rpl '{^([^}]+?)} s/^($$1)/uc($1)/e;'
  --rpl '{^^([^}]+?)} s/($$1)/uc($1)/eg;'
  --rpl '{,([^}]+?)} s/^($$1)/lc($1)/e;'
  --rpl '{,,([^}]+?)} s/($$1)/lc($1)/eg;'

  --rpl '{slot} 1 $_="\${PARALLEL_JOBSLOT}";uq()'
  --rpl '{host} 1 $_="\${PARALLEL_SSHHOST}";uq()'
  --rpl '{sshlogin} 1 $_="\${PARALLEL_SSHLOGIN}";uq()'
  --rpl '{hgrp} 1 $_="\${PARALLEL_HOSTGROUPS}";uq()'
  --rpl '{agrp} 1 $_="\${PARALLEL_ARGHOSTGROUPS}";uq()'
@end verbatim

If the user defined replacement string starts with '@{' it can also be
used as a positional replacement string (like @strong{@{2.@}}).

It is recommended to only change $_ but you have full access to all
of GNU @strong{parallel}'s internal functions and data structures.

Here are a few examples:

@verbatim
  Is the job sequence even or odd?
  --rpl '{odd} $_ = seq() % 2 ? "odd" : "even"'
  Pad job sequence with leading zeros to get equal width
  --rpl '{0#} $f=1+int("".(log(total_jobs())/log(10)));
    $_=sprintf("%0${f}d",seq())'
  Job sequence counting from 0
  --rpl '{#0} $_ = seq() - 1'
  Job slot counting from 2
  --rpl '{%1} $_ = slot() + 1'
  Remove all extensions
  --rpl '{:} s:(\.[^/]+)*$::'
@end verbatim

You can have dynamic replacement strings by including parenthesis in
the replacement string and adding a regular expression between the
parenthesis. The matching string will be inserted as $$1:

@verbatim
  parallel --rpl '{%(.*?)} s/$$1//' echo {%.tar.gz} ::: my.tar.gz
  parallel --rpl '{:%(.+?)} s:$$1(\.[^/]+)*$::' \
    echo {:%_file} ::: my_file.tar.gz
  parallel -n3 --rpl '{/:%(.*?)} s:.*/(.*)$$1(\.[^/]+)*$:$1:' \
    echo job {#}: {2} {2.} {3/:%_1} ::: a/b.c c/d.e f/g_1.h.i
@end verbatim

You can even use multiple matches:

@verbatim
  parallel --rpl '{/(.+?)/(.*?)} s/$$1/$$2/;'
    echo {/replacethis/withthis} {/b/C} ::: a_replacethis_b

  parallel --rpl '{(.*?)/(.*?)} $_="$$2$_$$1"' \
    echo {swap/these} ::: -middle-
@end verbatim

See also: @strong{@{=}@emph{perl expression}@strong{=@}} @strong{--parens}

@item @strong{--rsync-opts} @emph{options}
@anchor{@strong{--rsync-opts} @emph{options}}

Options to pass on to @strong{rsync}.

Setting @strong{--rsync-opts} takes precedence over setting the environment
variable $PARALLEL_RSYNC_OPTS.

@item @strong{--max-chars} @emph{max-chars}
@anchor{@strong{--max-chars} @emph{max-chars}}

@item @strong{-s} @emph{max-chars}
@anchor{@strong{-s} @emph{max-chars}}

Limit length of command.

Use at most @emph{max-chars} characters per command line, including the
command and initial-arguments and the terminating nulls at the ends of
the argument strings.  The largest allowed value is system-dependent,
and is calculated as the argument length limit for exec, less the size
of your environment.  The default value is the maximum.

@emph{max-chars} can be postfixed with K, M, G, T, P, k, m, g, t, or p
(see UNIT PREFIX).

Implies @strong{-X} unless @strong{-m} or @strong{--xargs} is set.

See also: @strong{-X} @strong{-m} @strong{--xargs} @strong{--max-line-length-allowed}
@strong{--show-limits}

@item @strong{--show-limits}
@anchor{@strong{--show-limits}}

Display limits given by the operating system.

Display the limits on the command-line length which are imposed by the
operating system and the @strong{-s} option.  Pipe the input from /dev/null
(and perhaps specify --no-run-if-empty) if you don't want GNU @strong{parallel}
to do anything.

See also: @strong{--max-chars} @strong{--max-line-length-allowed} @strong{--version}

@item @strong{--semaphore}
@anchor{@strong{--semaphore}}

Work as a counting semaphore.

@strong{--semaphore} will cause GNU @strong{parallel} to start @emph{command} in the
background. When the number of jobs given by @strong{--jobs} is reached, GNU
@strong{parallel} will wait for one of these to complete before starting
another command.

@strong{--semaphore} implies @strong{--bg} unless @strong{--fg} is specified.

The command @strong{sem} is an alias for @strong{parallel --semaphore}.

See also: @strong{man sem} @strong{--bg} @strong{--fg} @strong{--semaphore-name}
@strong{--semaphore-timeout} @strong{--wait}

@item @strong{--semaphore-name} @emph{name}
@anchor{@strong{--semaphore-name} @emph{name}}

@item @strong{--id} @emph{name}
@anchor{@strong{--id} @emph{name}}

Use @strong{name} as the name of the semaphore.

The default is the name of the controlling tty (output from @strong{tty}).

The default normally works as expected when used interactively, but
when used in a script @emph{name} should be set. @emph{$$} or @emph{my_task_name}
are often a good value.

The semaphore is stored in ~/.parallel/semaphores/

Implies @strong{--semaphore}.

See also: @strong{man sem} @strong{--semaphore}

@item @strong{--semaphore-timeout} @emph{secs}
@anchor{@strong{--semaphore-timeout} @emph{secs}}

@item @strong{--st} @emph{secs}
@anchor{@strong{--st} @emph{secs}}

If @emph{secs} > 0: If the semaphore is not released within @emph{secs}
seconds, take it anyway.

If @emph{secs} < 0: If the semaphore is not released within @emph{secs}
seconds, exit.

@emph{secs} is in seconds, but can be postfixed with s, m, h, or d (see
the section TIME POSTFIXES).

Implies @strong{--semaphore}.

See also: @strong{man sem}

@item @strong{--seqreplace} @emph{replace-str}
@anchor{@strong{--seqreplace} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{#@}} for
job sequence number.

See also: @strong{@{#@}}

@item @strong{--session}
@anchor{@strong{--session}}

Record names in current environment in @strong{$PARALLEL_IGNORED_NAMES} and
exit.

Only used with @strong{env_parallel}. Aliases, functions, and variables with
names in @strong{$PARALLEL_IGNORED_NAMES} will not be copied.  So you should
set variables/function you want copied @emph{after} running @strong{--session}.

It is similar to @strong{--record-env}, but only for this session.

Only supported in @strong{Ash, Bash, Dash, Ksh, Sh, and Zsh}.

See also: @strong{--env} @strong{--record-env} @strong{env_parallel}

@item @strong{--shard} @emph{shardexpr}
@anchor{@strong{--shard} @emph{shardexpr}}

Use @emph{shardexpr} as shard key and shard input to the jobs.

@emph{shardexpr} is [column number|column name] [perlexpression] e.g.:

@verbatim
  3
  Address
  3 $_%=100
  Address s/\d//g
@end verbatim

Each input line is split using @strong{--colsep}. The string of the column
is put into $_, the perl expression is executed, the resulting string
is hashed so that all lines of a given value is given to the same job
slot.

This is similar to sharding in databases.

The performance is in the order of 100K rows per second. Faster if the
@emph{shardcol} is small (<10), slower if it is big (>100).

@strong{--shard} requires @strong{--pipe} and a fixed numeric value for @strong{--jobs}.

See the section: SPREADING BLOCKS OF DATA.

See also: @strong{--bin} @strong{--group-by} @strong{--round-robin}

@item @strong{--shebang}
@anchor{@strong{--shebang}}

@item @strong{--hashbang}
@anchor{@strong{--hashbang}}

GNU @strong{parallel} can be called as a shebang (#!) command as the first
line of a script. The content of the file will be treated as
inputsource.

Like this:

@verbatim
  #!/usr/bin/parallel --shebang -r wget

  https://ftpmirror.gnu.org/parallel/parallel-20120822.tar.bz2
  https://ftpmirror.gnu.org/parallel/parallel-20130822.tar.bz2
  https://ftpmirror.gnu.org/parallel/parallel-20140822.tar.bz2
@end verbatim

@strong{--shebang} must be set as the first option.

On FreeBSD @strong{env} is needed:

@verbatim
  #!/usr/bin/env -S parallel --shebang -r wget

  https://ftpmirror.gnu.org/parallel/parallel-20120822.tar.bz2
  https://ftpmirror.gnu.org/parallel/parallel-20130822.tar.bz2
  https://ftpmirror.gnu.org/parallel/parallel-20140822.tar.bz2
@end verbatim

There are many limitations of shebang (#!) depending on your operating
system. See details on https://www.in-ulm.de/~mascheck/various/shebang/

See also: @strong{--shebang-wrap}

@item @strong{--shebang-wrap}
@anchor{@strong{--shebang-wrap}}

GNU @strong{parallel} can parallelize scripts by wrapping the shebang
line. If the program can be run like this:

@verbatim
  cat arguments | parallel the_program
@end verbatim

then the script can be changed to:

@verbatim
  #!/usr/bin/parallel --shebang-wrap /original/parser --options
@end verbatim

E.g.

@verbatim
  #!/usr/bin/parallel --shebang-wrap /usr/bin/python
@end verbatim

If the program can be run like this:

@verbatim
  cat data | parallel --pipe the_program
@end verbatim

then the script can be changed to:

@verbatim
  #!/usr/bin/parallel --shebang-wrap --pipe /orig/parser --opts
@end verbatim

E.g.

@verbatim
  #!/usr/bin/parallel --shebang-wrap --pipe /usr/bin/perl -w
@end verbatim

@strong{--shebang-wrap} must be set as the first option.

See also: @strong{--shebang}

@item @strong{--shell-completion} @emph{shell}
@anchor{@strong{--shell-completion} @emph{shell}}

Generate shell completion code for interactive shells.

Supported shells: bash zsh.

Use @emph{auto} as @emph{shell} to automatically detect running shell.

Activate the completion code with:

@verbatim
  zsh% eval "$(parallel --shell-completion auto)"
  bash$ eval "$(parallel --shell-completion auto)"
@end verbatim

Or put this `/usr/share/zsh/site-functions/_parallel`, then `compinit`
to generate `~/.zcompdump`:

@verbatim
  #compdef parallel
  
  (( $+functions[_comp_parallel] )) ||
    eval "$(parallel --shell-completion auto)" &&
    _comp_parallel
@end verbatim

@item @strong{--shell-quote}
@anchor{@strong{--shell-quote}}

Does not run the command but quotes it. Useful for making quoted
composed commands for GNU @strong{parallel}.

Multiple @strong{--shell-quote} with quote the string multiple times, so
@strong{parallel --shell-quote | parallel --shell-quote} can be written as
@strong{parallel --shell-quote --shell-quote}.

See also: @strong{--quote}

@item @strong{--shuf}
@anchor{@strong{--shuf}}

Shuffle jobs.

When having multiple input sources it is hard to randomize
jobs. @strong{--shuf} will generate all jobs, and shuffle them before
running them. This is useful to get a quick preview of the results
before running the full batch.

Combined with @strong{--halt soon,done=1%} you can run a random 1% sample of
all jobs:

@verbatim
  parallel --shuf --halt soon,done=1% echo ::: {1..100} ::: {1..100}
@end verbatim

See also: @strong{--halt}

@item @strong{--skip-first-line}
@anchor{@strong{--skip-first-line}}

Do not use the first line of input (used by GNU @strong{parallel} itself
when called with @strong{--shebang}).

@item @strong{--sql} @emph{DBURL} (obsolete)
@anchor{@strong{--sql} @emph{DBURL} (obsolete)}

Use @strong{--sql-master} instead.

@item @strong{--sql-master} @emph{DBURL}
@anchor{@strong{--sql-master} @emph{DBURL}}

Submit jobs via SQL server. @emph{DBURL} must point to a table, which will
contain the same information as @strong{--joblog}, the values from the input
sources (stored in columns V1 .. Vn), and the output (stored in
columns Stdout and Stderr).

If @emph{DBURL} is prepended with '+' GNU @strong{parallel} assumes the table is
already made with the correct columns and appends the jobs to it.

If @emph{DBURL} is not prepended with '+' the table will be dropped and
created with the correct amount of V-columns unless

@strong{--sqlmaster} does not run any jobs, but it creates the values for
the jobs to be run. One or more @strong{--sqlworker} must be run to actually
execute the jobs.

If @strong{--wait} is set, GNU @strong{parallel} will wait for the jobs to
complete.

The format of a DBURL is:

@verbatim
  [sql:]vendor://[[user][:pwd]@][host][:port]/[db]/table
@end verbatim

E.g.

@verbatim
  sql:mysql://hr:hr@localhost:3306/hrdb/jobs
  mysql://scott:tiger@my.example.com/pardb/paralleljobs
  sql:oracle://scott:tiger@ora.example.com/xe/parjob
  postgresql://scott:tiger@pg.example.com/pgdb/parjob
  pg:///parjob
  sqlite3:///%2Ftmp%2Fpardb.sqlite/parjob
  csv:///%2Ftmp%2Fpardb/parjob
@end verbatim

Notice how / in the path of sqlite and CVS must be encoded as
%2F. Except the last / in CSV which must be a /.

It can also be an alias from ~/.sql/aliases:

@verbatim
  :myalias mysql:///mydb/paralleljobs
@end verbatim

See also: @strong{--sql-and-worker} @strong{--sql-worker} @strong{--joblog}

@item @strong{--sql-and-worker} @emph{DBURL}
@anchor{@strong{--sql-and-worker} @emph{DBURL}}

Shorthand for: @strong{--sql-master} @emph{DBURL} @strong{--sql-worker} @emph{DBURL}.

See also: @strong{--sql-master} @strong{--sql-worker}

@item @strong{--sql-worker} @emph{DBURL}
@anchor{@strong{--sql-worker} @emph{DBURL}}

Execute jobs via SQL server. Read the input sources variables from the
table pointed to by @emph{DBURL}. The @emph{command} on the command line
should be the same as given by @strong{--sqlmaster}.

If you have more than one @strong{--sqlworker} jobs may be run more than
once.

If @strong{--sqlworker} runs on the local machine, the hostname in the SQL
table will not be ':' but instead the hostname of the machine.

See also: @strong{--sql-master} @strong{--sql-and-worker}

@item @strong{--ssh} @emph{sshcommand}
@anchor{@strong{--ssh} @emph{sshcommand}}

GNU @strong{parallel} defaults to using @strong{ssh} for remote access. This can
be overridden with @strong{--ssh}. It can also be set on a per server
basis with @strong{--sshlogin}.

See also: @strong{--sshlogin}

@item @strong{--ssh-delay} @emph{duration}
@anchor{@strong{--ssh-delay} @emph{duration}}

Delay starting next ssh by @emph{duration}.

GNU @strong{parallel} will not start another ssh for the next @emph{duration}.

@emph{duration} is in seconds, but can be postfixed with s, m, h, or d.

See also: TIME POSTFIXES @strong{--sshlogin} @strong{--delay}

@item @strong{--sshlogin} @emph{[@@hostgroups/][ncpus/]sshlogin[,[@@hostgroups/][ncpus/]sshlogin[,...]]}
@anchor{@strong{--sshlogin} @emph{[@@hostgroups/][ncpus/]sshlogin[@comma{}[@@hostgroups/][ncpus/]sshlogin[@comma{}...]]}}

@item @strong{--sshlogin} @emph{@@hostgroup}
@anchor{@strong{--sshlogin} @emph{@@hostgroup}}

@item @strong{-S} @emph{[@@hostgroups/][ncpus/]sshlogin[,[@@hostgroups/][ncpus/]sshlogin[,...]]}
@anchor{@strong{-S} @emph{[@@hostgroups/][ncpus/]sshlogin[@comma{}[@@hostgroups/][ncpus/]sshlogin[@comma{}...]]}}

@item @strong{-S} @emph{@@hostgroup}
@anchor{@strong{-S} @emph{@@hostgroup}}

Distribute jobs to remote computers.

The jobs will be run on a list of remote computers.

If @emph{hostgroups} is given, the @emph{sshlogin} will be added to that
hostgroup. Multiple hostgroups are separated by '+'. The @emph{sshlogin}
will always be added to a hostgroup named the same as @emph{sshlogin}.

If only the @emph{@@hostgroup} is given, only the sshlogins in that
hostgroup will be used. Multiple @emph{@@hostgroup} can be given.

GNU @strong{parallel} will determine the number of CPUs on the remote
computers and run the number of jobs as specified by @strong{-j}.  If the
number @emph{ncpus} is given GNU @strong{parallel} will use this number for
number of CPUs on the host. Normally @emph{ncpus} will not be
needed.

An @emph{sshlogin} is of the form:

@verbatim
  [sshcommand [options]] [username[:password]@]hostname
@end verbatim

If @emph{password} is given, @strong{sshpass} will be used. Otherwise the
sshlogin must not require a password (@strong{ssh-agent} and @strong{ssh-copy-id}
may help with that).

If the hostname is an IPv6 address, the port can be given separated
with p or #. If the address is enclosed in [] you can also use :.
E.g. ::1p2222 ::1#2222 [::1]:2222

The sshlogin ':' is special, it means 'no ssh' and will therefore run
on the local computer.

The sshlogin '..' is special, it read sshlogins from ~/.parallel/sshloginfile or
$XDG_CONFIG_HOME/parallel/sshloginfile

The sshlogin '-' is special, too, it read sshlogins from stdin
(standard input).

To specify more sshlogins separate the sshlogins by comma, newline (in
the same string), or repeat the options multiple times.

GNU @strong{parallel} splits on , (comma) so if your sshlogin contains ,
(comma) you need to replace it with \, or ,,

For examples: see @strong{--sshloginfile}.

The remote host must have GNU @strong{parallel} installed.

@strong{--sshlogin} is known to cause problems with @strong{-m} and @strong{-X}.

See also: @strong{--basefile} @strong{--transferfile} @strong{--return} @strong{--cleanup}
@strong{--trc} @strong{--sshloginfile} @strong{--workdir} @strong{--filter-hosts}
@strong{--ssh}

@item @strong{--sshloginfile} @emph{filename}
@anchor{@strong{--sshloginfile} @emph{filename}}

@item @strong{--slf} @emph{filename}
@anchor{@strong{--slf} @emph{filename}}

File with sshlogins. The file consists of sshlogins on separate
lines. Empty lines and lines starting with '#' are ignored. Example:

@verbatim
  server.example.com
  username@server2.example.com
  8/my-8-cpu-server.example.com
  2/my_other_username@my-dualcore.example.net
  # This server has SSH running on port 2222
  ssh -p 2222 server.example.net
  4/ssh -p 2222 quadserver.example.net
  # Use a different ssh program
  myssh -p 2222 -l myusername hexacpu.example.net
  # Use a different ssh program with default number of CPUs
  //usr/local/bin/myssh -p 2222 -l myusername hexacpu
  # Use a different ssh program with 6 CPUs
  6//usr/local/bin/myssh -p 2222 -l myusername hexacpu
  # Assume 16 CPUs on the local computer
  16/:
  # Put server1 in hostgroup1
  @hostgroup1/server1
  # Put myusername@server2 in hostgroup1+hostgroup2
  @hostgroup1+hostgroup2/myusername@server2
  # Force 4 CPUs and put 'ssh -p 2222 server3' in hostgroup1
  @hostgroup1/4/ssh -p 2222 server3
@end verbatim

When using a different ssh program the last argument must be the hostname.

Multiple @strong{--sshloginfile} are allowed.

GNU @strong{parallel} will first look for the file in current dir; if that
fails it look for the file in ~/.parallel.

The sshloginfile '..' is special, it read sshlogins from
~/.parallel/sshloginfile

The sshloginfile '.' is special, it read sshlogins from
/etc/parallel/sshloginfile

The sshloginfile '-' is special, too, it read sshlogins from stdin
(standard input).

If the sshloginfile is changed it will be re-read when a job finishes
though at most once per second. This makes it possible to add and
remove hosts while running.

This can be used to have a daemon that updates the sshloginfile to
only contain servers that are up:

@verbatim
    cp original.slf tmp2.slf
    while [ 1 ] ; do
      nice parallel --nonall -j0 -k --slf original.slf \
        --tag echo | perl 's/\t$//' > tmp.slf
      if diff tmp.slf tmp2.slf; then
        mv tmp.slf tmp2.slf
      fi
      sleep 10
    done &
    parallel --slf tmp2.slf ...
@end verbatim

See also: @strong{--filter-hosts}

@item @strong{--slotreplace} @emph{replace-str}
@anchor{@strong{--slotreplace} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{%@}} for
job slot number.

See also: @strong{@{%@}}

@item @strong{--silent}
@anchor{@strong{--silent}}

Silent.

The job to be run will not be printed. This is the default.  Can be
reversed with @strong{-v}.

See also: @strong{-v}

@item @strong{--template} @emph{file}=@emph{repl}
@anchor{@strong{--template} @emph{file}=@emph{repl}}

@item @strong{--tmpl} @emph{file}=@emph{repl}
@anchor{@strong{--tmpl} @emph{file}=@emph{repl}}

Replace replacement strings in @emph{file} and save it in @emph{repl}.

All replacement strings in the contents of @emph{file} will be
replaced. All replacement strings in the name @emph{repl} will be
replaced.

With @strong{--cleanup} the new file will be removed when the job is done.

If @emph{my.tmpl} contains this:

@verbatim
  Xval: {x}
  Yval: {y}
  FixedValue: 9
  # x with 2 decimals
  DecimalX: {=x $_=sprintf("%.2f",$_) =}
  TenX: {=x $_=$_*10 =}
  RandomVal: {=1 $_=rand() =}
@end verbatim

it can be used like this:

@verbatim
  myprog() { echo Using "$@"; cat "$@"; }
  export -f myprog
  parallel --cleanup --header : --tmpl my.tmpl={#}.t myprog {#}.t \
    ::: x 1.234 2.345 3.45678 ::: y 1 2 3
@end verbatim

See also: @strong{@{@}} @strong{--cleanup}

@item @strong{--tty}
@anchor{@strong{--tty}}

Open terminal tty.

If GNU @strong{parallel} is used for starting a program that accesses the
tty (such as an interactive program) then this option may be
needed. It will default to starting only one job at a time
(i.e. @strong{-j1}), not buffer the output (i.e. @strong{-u}), and it will open a
tty for the job.

You can of course override @strong{-j1} and @strong{-u}.

Using @strong{--tty} unfortunately means that GNU @strong{parallel} cannot kill
the jobs (with @strong{--timeout}, @strong{--memfree}, or @strong{--halt}). This is due
to GNU @strong{parallel} giving each child its own process group, which is
then killed. Process groups are dependant on the tty.

See also: @strong{--ungroup} @strong{--open-tty}

@item @strong{--tag}
@anchor{@strong{--tag}}

Tag lines with arguments.

Each output line will be prepended with the arguments and TAB
(\t). When combined with @strong{--onall} or @strong{--nonall} the lines will be
prepended with the sshlogin instead.

@strong{--tag} is ignored when using @strong{-u}.

See also: @strong{--tagstring} @strong{--ctag}

@item @strong{--tagstring} @emph{str}
@anchor{@strong{--tagstring} @emph{str}}

Tag lines with a string.

Each output line will be prepended with @emph{str} and TAB (\t). @emph{str}
can contain replacement strings such as @strong{@{@}}.

@strong{--tagstring} is ignored when using @strong{-u}, @strong{--onall}, and @strong{--nonall}.

See also: @strong{--tag} @strong{--ctagstring}

@item @strong{--tee}
@anchor{@strong{--tee}}

Pipe all data to all jobs.

Used with @strong{--pipe}/@strong{--pipe-part} and @strong{:::}.

@verbatim
  seq 1000 | parallel --pipe --tee -v wc {} ::: -w -l -c
@end verbatim

How many numbers in 1..1000 contain 0..9, and how many bytes do they
fill:

@verbatim
  seq 1000 | parallel --pipe --tee --tag \
    'grep {1} | wc {2}' ::: {0..9} ::: -l -c
@end verbatim

How many words contain a..z and how many bytes do they fill?

@verbatim
  parallel -a /usr/share/dict/words --pipe-part --tee --tag \
    'grep {1} | wc {2}' ::: {a..z} ::: -l -c
@end verbatim

See also: @strong{:::} @strong{--pipe} @strong{--pipe-part}

@item @strong{--term-seq} @emph{sequence}
@anchor{@strong{--term-seq} @emph{sequence}}

Termination sequence.

When a job is killed due to @strong{--timeout}, @strong{--memfree}, @strong{--halt}, or
abnormal termination of GNU @strong{parallel}, @emph{sequence} determines how
the job is killed. The default is:

@verbatim
    TERM,200,TERM,100,TERM,50,KILL,25
@end verbatim

which sends a TERM signal, waits 200 ms, sends another TERM signal,
waits 100 ms, sends another TERM signal, waits 50 ms, sends a KILL
signal, waits 25 ms, and exits. GNU @strong{parallel} detects if a process
dies before the waiting time is up.

See also: @strong{--halt} @strong{--timeout} @strong{--memfree}

@item @strong{--total-jobs} @emph{jobs}
@anchor{@strong{--total-jobs} @emph{jobs}}

@item @strong{--total} @emph{jobs}
@anchor{@strong{--total} @emph{jobs}}

Provide the total number of jobs for computing ETA which is also used
for @strong{--bar}.

Without @strong{--total-jobs} GNU Parallel will read all jobs before
starting a job. @strong{--total-jobs} is useful if the input is generated
slowly.

See also: @strong{--bar} @strong{--eta}

@item @strong{--tmpdir} @emph{dirname}
@anchor{@strong{--tmpdir} @emph{dirname}}

Directory for temporary files.

GNU @strong{parallel} normally buffers output into temporary files in
/tmp. By setting @strong{--tmpdir} you can use a different dir for the
files. Setting @strong{--tmpdir} is equivalent to setting $TMPDIR.

See also: @strong{--compress} @strong{$TMPDIR} @strong{$PARALLEL_REMOTE_TMPDIR}

@item @strong{--tmux} (Long beta testing)
@anchor{@strong{--tmux} (Long beta testing)}

Use @strong{tmux} for output. Start a @strong{tmux} session and run each job in a
window in that session. No other output will be produced.

See also: @strong{--tmuxpane}

@item @strong{--tmuxpane} (Long beta testing)
@anchor{@strong{--tmuxpane} (Long beta testing)}

Use @strong{tmux} for output but put output into panes in the first window.
Useful if you want to monitor the progress of less than 100 concurrent
jobs.

See also: @strong{--tmux}

@item @strong{--timeout} @emph{duration}
@anchor{@strong{--timeout} @emph{duration}}

Time out for command. If the command runs for longer than @emph{duration}
seconds it will get killed as per @strong{--term-seq}.

If @emph{duration} is followed by a % then the timeout will dynamically be
computed as a percentage of the median average runtime of successful
jobs. Only values > 100% will make sense.

@emph{duration} is in seconds, but can be postfixed with s, m, h, or d.

See also: TIME POSTFIXES @strong{--term-seq} @strong{--retries}

@item @strong{--verbose}
@anchor{@strong{--verbose}}

@item @strong{-t}
@anchor{@strong{-t}}

Print the job to be run on stderr (standard error).

See also: @strong{-v} @strong{--interactive}

@item @strong{--transfer}
@anchor{@strong{--transfer}}

Transfer files to remote computers.

Shorthand for: @strong{--transferfile @{@}}.

See also: @strong{--transferfile}.

@item @strong{--transferfile} @emph{filename}
@anchor{@strong{--transferfile} @emph{filename}}

@item @strong{--tf} @emph{filename}
@anchor{@strong{--tf} @emph{filename}}

Transfer @emph{filename} to remote computers.

@strong{--transferfile} is used with @strong{--sshlogin} to transfer files to the
remote computers. The files will be transferred using @strong{rsync} and
will be put relative to the work dir.

The @emph{filename} will normally contain a replacement string.

If the path contains /./ the remaining path will be relative to the
work dir (for details: see @strong{rsync}). If the work dir is
@strong{/home/user}, the transferring will be as follows:

@verbatim
  /tmp/foo/bar   => /tmp/foo/bar
  tmp/foo/bar    => /home/user/tmp/foo/bar
  /tmp/./foo/bar => /home/user/foo/bar
  tmp/./foo/bar  => /home/user/foo/bar
@end verbatim

@emph{Examples}

This will transfer the file @emph{foo/bar.txt} to the computer
@emph{server.example.com} to the file @emph{$HOME/foo/bar.txt} before running
@strong{wc foo/bar.txt} on @emph{server.example.com}:

@verbatim
  echo foo/bar.txt | parallel --transferfile {} \
    --sshlogin server.example.com wc
@end verbatim

This will transfer the file @emph{/tmp/foo/bar.txt} to the computer
@emph{server.example.com} to the file @emph{/tmp/foo/bar.txt} before running
@strong{wc /tmp/foo/bar.txt} on @emph{server.example.com}:

@verbatim
  echo /tmp/foo/bar.txt | parallel --transferfile {} \
    --sshlogin server.example.com wc
@end verbatim

This will transfer the file @emph{/tmp/foo/bar.txt} to the computer
@emph{server.example.com} to the file @emph{foo/bar.txt} before running
@strong{wc ./foo/bar.txt} on @emph{server.example.com}:

@verbatim
  echo /tmp/./foo/bar.txt | parallel --transferfile {} \
    --sshlogin server.example.com wc {= s:.*/\./:./: =}
@end verbatim

@strong{--transferfile} is often used with @strong{--return} and @strong{--cleanup}. A
shorthand for @strong{--transferfile @{@}} is @strong{--transfer}.

@strong{--transferfile} is ignored when used with @strong{--sshlogin :} or when
not used with @strong{--sshlogin}.

See also: @strong{--workdir} @strong{--sshlogin} @strong{--basefile} @strong{--return}
@strong{--cleanup}

@item @strong{--trc} @emph{filename}
@anchor{@strong{--trc} @emph{filename}}

Transfer, Return, Cleanup. Shorthand for: @strong{--transfer} @strong{--return}
@emph{filename} @strong{--cleanup}

See also: @strong{--transfer} @strong{--return} @strong{--cleanup}

@item @strong{--trim} <n|l|r|lr|rl>
@anchor{@strong{--trim} <n|l|r|lr|rl>}

Trim white space in input.

@table @asis
@item n
@anchor{n}

No trim. Input is not modified. This is the default.

@item l
@anchor{l}

Left trim. Remove white space from start of input. E.g. " a bc " -> "a bc ".

@item r
@anchor{r}

Right trim. Remove white space from end of input. E.g. " a bc " -> " a bc".

@item lr
@anchor{lr}

@item rl
@anchor{rl}

Both trim. Remove white space from both start and end of input. E.g. "
a bc " -> "a bc". This is the default if @strong{--colsep} is used.

@end table

See also: @strong{--no-run-if-empty} @strong{@{@}} @strong{--colsep}

@item @strong{--ungroup}
@anchor{@strong{--ungroup}}

@item @strong{-u}
@anchor{@strong{-u}}

Ungroup output.

Output is printed as soon as possible and bypasses GNU @strong{parallel}
internal processing. This may cause output from different commands to
be mixed thus should only be used if you do not care about the
output. Compare these:

@verbatim
  seq 4 | parallel -j0 \
    'sleep {};echo -n start{};sleep {};echo {}end'
  seq 4 | parallel -u -j0 \
    'sleep {};echo -n start{};sleep {};echo {}end'
@end verbatim

It also disables @strong{--tag}. GNU @strong{parallel} outputs faster with
@strong{-u}. Compare the speeds of these:

@verbatim
  parallel seq ::: 300000000 >/dev/null
  parallel -u seq ::: 300000000 >/dev/null
  parallel --line-buffer seq ::: 300000000 >/dev/null
@end verbatim

Can be reversed with @strong{--group}.

See also: @strong{--line-buffer} @strong{--group}

@item @strong{--extensionreplace} @emph{replace-str}
@anchor{@strong{--extensionreplace} @emph{replace-str}}

@item @strong{--er} @emph{replace-str}
@anchor{@strong{--er} @emph{replace-str}}

Use the replacement string @emph{replace-str} instead of @strong{@{.@}} for input
line without extension.

See also: @strong{@{.@}}

@item @strong{--use-sockets-instead-of-threads}
@anchor{@strong{--use-sockets-instead-of-threads}}

See also: @strong{--use-cores-instead-of-threads}

@item @strong{--use-cores-instead-of-threads}
@anchor{@strong{--use-cores-instead-of-threads}}

@item @strong{--use-cpus-instead-of-cores} (obsolete)
@anchor{@strong{--use-cpus-instead-of-cores} (obsolete)}

Determine how GNU @strong{parallel} counts the number of CPUs.

GNU @strong{parallel} uses this number when the number of jobslots
(@strong{--jobs}) is computed relative to the number of CPUs (e.g. 100% or
+1).

CPUs can be counted in three different ways:

@table @asis
@item sockets
@anchor{sockets}

The number of filled CPU sockets (i.e. the number of physical chips).

@item cores
@anchor{cores}

The number of physical cores (i.e. the number of physical compute
cores).

@item threads
@anchor{threads}

The number of hyperthreaded cores (i.e. the number of virtual
cores - with some of them possibly being hyperthreaded)

@end table

Normally the number of CPUs is computed as the number of CPU
threads. With @strong{--use-sockets-instead-of-threads} or
@strong{--use-cores-instead-of-threads} you can force it to be computed as
the number of filled sockets or number of cores instead.

Most users will not need these options.

@strong{--use-cpus-instead-of-cores} is a (misleading) alias for
@strong{--use-sockets-instead-of-threads} and is kept for backwards
compatibility.

See also: @strong{--number-of-threads} @strong{--number-of-cores}
@strong{--number-of-sockets}

@item @strong{-v}
@anchor{@strong{-v}}

Verbose.

Print the job to be run on stdout (standard output). Can be reversed
with @strong{--silent}.

Use @strong{-v} @strong{-v} to print the wrapping ssh command when running remotely.

See also: @strong{-t}

@item @strong{--version}
@anchor{@strong{--version}}

@item @strong{-V}
@anchor{@strong{-V}}

Print the version GNU @strong{parallel} and exit.

@item @strong{--workdir} @emph{mydir}
@anchor{@strong{--workdir} @emph{mydir}}

@item @strong{--wd} @emph{mydir}
@anchor{@strong{--wd} @emph{mydir}}

Jobs will be run in the dir @emph{mydir}. The default is the current dir
for the local machine, and the login dir for remote computers.

Files transferred using @strong{--transferfile} and @strong{--return} will be
relative to @emph{mydir} on remote computers.

The special @emph{mydir} value @strong{...} will create working dirs under
@strong{~/.parallel/tmp/}. If @strong{--cleanup} is given these dirs will be
removed.

The special @emph{mydir} value @strong{.} uses the current working dir.  If the
current working dir is beneath your home dir, the value @strong{.} is
treated as the relative path to your home dir. This means that if your
home dir is different on remote computers (e.g. if your login is
different) the relative path will still be relative to your home dir.

To see the difference try:

@verbatim
  parallel -S server pwd ::: ""
  parallel --wd . -S server pwd ::: ""
  parallel --wd ... -S server pwd ::: ""
@end verbatim

@emph{mydir} can contain GNU @strong{parallel}'s replacement strings.

@item @strong{--wait}
@anchor{@strong{--wait}}

Wait for all commands to complete.

Used with @strong{--semaphore} or @strong{--sqlmaster}.

See also: @strong{man sem}

@item @strong{-X}
@anchor{@strong{-X}}

Multiple arguments with context replace. Insert as many arguments as
the command line length permits. If multiple jobs are being run in
parallel: distribute the arguments evenly among the jobs. Use @strong{-j1}
to avoid this.

If @strong{@{@}} is not used the arguments will be appended to the line.  If
@strong{@{@}} is used as part of a word (like @emph{pic@{@}.jpg}) then the whole
word will be repeated. If @strong{@{@}} is used multiple times each @strong{@{@}} will
be replaced with the arguments.

Normally @strong{-X} will do the right thing, whereas @strong{-m} can give
unexpected results if @strong{@{@}} is used as part of a word.

Support for @strong{-X} with @strong{--sshlogin} is limited and may fail.

See also: @strong{-m}

@item @strong{--exit}
@anchor{@strong{--exit}}

@item @strong{-x}
@anchor{@strong{-x}}

Exit if the size (see the @strong{-s} option) is exceeded.

@item @strong{--xargs}
@anchor{@strong{--xargs}}

Multiple arguments. Insert as many arguments as the command line
length permits.

If @strong{@{@}} is not used the arguments will be appended to the
line.  If @strong{@{@}} is used multiple times each @strong{@{@}} will be replaced
with all the arguments.

Support for @strong{--xargs} with @strong{--sshlogin} is limited and may fail.

See also: @strong{-X}

@end table

@node EXAMPLES
@chapter EXAMPLES

See: @strong{man parallel_examples}

@node SPREADING BLOCKS OF DATA
@chapter SPREADING BLOCKS OF DATA

@strong{--round-robin}, @strong{--pipe-part}, @strong{--shard}, @strong{--bin} and
@strong{--group-by} are all specialized versions of @strong{--pipe}.

In the following @emph{n} is the number of jobslots given by @strong{--jobs}. A
record starts with @strong{--recstart} and ends with @strong{--recend}. It is
typically a full line. A chunk is a number of full records that is
approximately the size of a block. A block can contain half records, a
chunk cannot.

@strong{--pipe} starts one job per chunk. It reads blocks from stdin
(standard input). It finds a record end near a block border and passes
a chunk to the program.

@strong{--pipe-part} starts one job per chunk - just like normal
@strong{--pipe}. It first finds record endings near all block borders in the
file and then starts the jobs. By using @strong{--block -1} it will set the
block size to size-of-file/@emph{n}. Used this way it will start @emph{n}
jobs in total.

@strong{--round-robin} starts @emph{n} jobs in total. It reads a block and
passes a chunk to whichever job is ready to read. It does not parse
the content except for identifying where a record ends to make sure it
only passes full records.

@strong{--shard} starts @emph{n} jobs in total. It parses each line to read the
string in the given column. Based on this string the line is passed to
one of the @emph{n} jobs. All lines having this string will be given to the
same jobslot.

@strong{--bin} works like @strong{--shard} but the value of the column must be
numeric and is the jobslot number it will be passed to. If the value
is bigger than @emph{n}, then @emph{n} will be subtracted from the value until
the value is smaller than or equal to @emph{n}.

@strong{--group-by} starts one job per chunk. Record borders are not given
by @strong{--recend}/@strong{--recstart}. Instead a record is defined by a group
of lines having the same string in a given column. So the string of a
given column changes at a chunk border. With @strong{--pipe} every line is
parsed, with @strong{--pipe-part} only a few lines are parsed to find the
chunk border.

@strong{--group-by} can be combined with @strong{--round-robin} or @strong{--pipe-part}.

@node TIME POSTFIXES
@chapter TIME POSTFIXES

Arguments that give a duration are given in seconds, but can be
expressed as floats postfixed with @strong{s}, @strong{m}, @strong{h}, or @strong{d} which
would multiply the float by 1, 60, 60*60, or 60*60*24. Thus these are
equivalent: 100000 and 1d3.5h16.6m4s.

@node UNIT PREFIX
@chapter UNIT PREFIX

Many numerical arguments in GNU @strong{parallel} can be postfixed with K,
M, G, T, P, k, m, g, t, or p which would multiply the number with
1024, 1048576, 1073741824, 1099511627776, 1125899906842624, 1000,
1000000, 1000000000, 1000000000000, or 1000000000000000, respectively.

You can even give it as a math expression. E.g. 1000000 can be written
as 1M-12*2.024*2k.

@node QUOTING
@chapter QUOTING

GNU @strong{parallel} is very liberal in quoting. You only need to quote
characters that have special meaning in shell:

@verbatim
  ( ) $ ` ' " < > ; | \
@end verbatim

and depending on context these needs to be quoted, too:

@verbatim
  ~ & # ! ? space * {
@end verbatim

Therefore most people will never need more quoting than putting '\'
in front of the special characters.

Often you can simply put \' around every ':

@verbatim
  perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"' file
@end verbatim

can be quoted:

@verbatim
  parallel perl -ne \''/^\S+\s+\S+$/ and print $ARGV,"\n"'\' ::: file
@end verbatim

However, when you want to use a shell variable you need to quote the
$-sign. Here is an example using $PARALLEL_SEQ. This variable is set
by GNU @strong{parallel} itself, so the evaluation of the $ must be done by
the sub shell started by GNU @strong{parallel}:

@verbatim
  seq 10 | parallel -N2 echo seq:\$PARALLEL_SEQ arg1:{1} arg2:{2}
@end verbatim

If the variable is set before GNU @strong{parallel} starts you can do this:

@verbatim
  VAR=this_is_set_before_starting
  echo test | parallel echo {} $VAR
@end verbatim

Prints: @strong{test this_is_set_before_starting}

It is a little more tricky if the variable contains more than one space in a row:

@verbatim
  VAR="two  spaces  between  each  word"
  echo test | parallel echo {} \'"$VAR"\'
@end verbatim

Prints: @strong{test two  spaces  between  each  word}

If the variable should not be evaluated by the shell starting GNU
@strong{parallel} but be evaluated by the sub shell started by GNU
@strong{parallel}, then you need to quote it:

@verbatim
  echo test | parallel VAR=this_is_set_after_starting \; echo {} \$VAR
@end verbatim

Prints: @strong{test this_is_set_after_starting}

It is a little more tricky if the variable contains space:

@verbatim
  echo test |\
    parallel VAR='"two  spaces  between  each  word"' echo {} \'"$VAR"\'
@end verbatim

Prints: @strong{test two  spaces  between  each  word}

$$ is the shell variable containing the process id of the shell. This
will print the process id of the shell running GNU @strong{parallel}:

@verbatim
  seq 10 | parallel echo $$
@end verbatim

And this will print the process ids of the sub shells started by GNU
@strong{parallel}.

@verbatim
  seq 10 | parallel echo \$\$
@end verbatim

If the special characters should not be evaluated by the sub shell
then you need to protect it against evaluation from both the shell
starting GNU @strong{parallel} and the sub shell:

@verbatim
  echo test | parallel echo {} \\\$VAR
@end verbatim

Prints: @strong{test $VAR}

GNU @strong{parallel} can protect against evaluation by the sub shell by
using -q:

@verbatim
  echo test | parallel -q echo {} \$VAR
@end verbatim

Prints: @strong{test $VAR}

This is particularly useful if you have lots of quoting. If you want
to run a perl script like this:

@verbatim
  perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"' file
@end verbatim

It needs to be quoted like one of these:

@verbatim
  ls | parallel perl -ne '/^\\S+\\s+\\S+\$/\ and\ print\ \$ARGV,\"\\n\"'
  ls | parallel perl -ne \''/^\S+\s+\S+$/ and print $ARGV,"\n"'\'
@end verbatim

Notice how spaces, \'s, "'s, and $'s need to be quoted. GNU
@strong{parallel} can do the quoting by using option -q:

@verbatim
  ls | parallel -q  perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"'
@end verbatim

However, this means you cannot make the sub shell interpret special
characters. For example because of @strong{-q} this WILL NOT WORK:

@verbatim
  ls *.gz | parallel -q "zcat {} >{.}"
  ls *.gz | parallel -q "zcat {} | bzip2 >{.}.bz2"
@end verbatim

because > and | need to be interpreted by the sub shell.

If you get errors like:

@verbatim
  sh: -c: line 0: syntax error near unexpected token
  sh: Syntax error: Unterminated quoted string
  sh: -c: line 0: unexpected EOF while looking for matching `''
  sh: -c: line 1: syntax error: unexpected end of file
  zsh:1: no matches found:
@end verbatim

then you might try using @strong{-q}.

If you are using @strong{bash} process substitution like @strong{<(cat foo)} then
you may try @strong{-q} and prepending @emph{command} with @strong{bash -c}:

@verbatim
  ls | parallel -q bash -c 'wc -c <(echo {})'
@end verbatim

Or for substituting output:

@verbatim
  ls | parallel -q bash -c \
    'tar c {} | tee >(gzip >{}.tar.gz) | bzip2 >{}.tar.bz2'
@end verbatim

@strong{Conclusion}: If this is confusing consider avoiding having to deal
with quoting by writing a small script or a function (remember to
@strong{export -f} the function) and have GNU @strong{parallel} call that.

@node LIST RUNNING JOBS
@chapter LIST RUNNING JOBS

If you want a list of the jobs currently running you can run:

@verbatim
  killall -USR1 parallel
@end verbatim

GNU @strong{parallel} will then print the currently running jobs on stderr
(standard error).

@node COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS
@chapter COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS

If you regret starting a lot of jobs you can simply break GNU @strong{parallel},
but if you want to make sure you do not have half-completed jobs you
should send the signal @strong{SIGHUP} to GNU @strong{parallel}:

@verbatim
  killall -HUP parallel
@end verbatim

This will tell GNU @strong{parallel} to not start any new jobs, but wait until
the currently running jobs are finished before exiting.

@node ENVIRONMENT VARIABLES
@chapter ENVIRONMENT VARIABLES

@table @asis
@item $PARALLEL_HOME
@anchor{$PARALLEL_HOME}

Dir where GNU @strong{parallel} stores config files, semaphores, and caches
information between invocations. If set to a non-existent dir, the dir
will be created.

Default: $HOME/.parallel.

@item $PARALLEL_ARGHOSTGROUPS
@anchor{$PARALLEL_ARGHOSTGROUPS}

When using @strong{--hostgroups} GNU @strong{parallel} sets this to the hostgroups
of the job.

Remember to quote the $, so it gets evaluated by the correct shell. Or
use @strong{--plus} and @{agrp@}.

@item $PARALLEL_HOSTGROUPS
@anchor{$PARALLEL_HOSTGROUPS}

When using @strong{--hostgroups} GNU @strong{parallel} sets this to the hostgroups
of the sshlogin that the job is run on.

Remember to quote the $, so it gets evaluated by the correct shell. Or
use @strong{--plus} and @{hgrp@}.

@item $PARALLEL_JOBSLOT
@anchor{$PARALLEL_JOBSLOT}

Set by GNU @strong{parallel} and can be used in jobs run by GNU @strong{parallel}.
Remember to quote the $, so it gets evaluated by the correct shell. Or
use @strong{--plus} and @{slot@}.

$PARALLEL_JOBSLOT is the jobslot of the job. It is equal to @{%@} unless
the job is being retried. See @{%@} for details.

@item $PARALLEL_PID
@anchor{$PARALLEL_PID}

Set by GNU @strong{parallel} and can be used in jobs run by GNU @strong{parallel}.
Remember to quote the $, so it gets evaluated by the correct shell.

This makes it possible for the jobs to communicate directly to GNU
@strong{parallel}.

@strong{Example:} If each of the jobs tests a solution and one of jobs finds
the solution the job can tell GNU @strong{parallel} not to start more jobs
by: @strong{kill -HUP $PARALLEL_PID}. This only works on the local
computer.

@item $PARALLEL_RSYNC_OPTS
@anchor{$PARALLEL_RSYNC_OPTS}

Options to pass on to @strong{rsync}. Defaults to: -rlDzR.

@item $PARALLEL_SHELL
@anchor{$PARALLEL_SHELL}

Use this shell for the commands run by GNU @strong{parallel}:

@itemize
@item $PARALLEL_SHELL. If undefined use:

@item The shell that started GNU @strong{parallel}. If that cannot be determined:

@item $SHELL. If undefined use:

@item /bin/sh

@end itemize

@item $PARALLEL_SSH
@anchor{$PARALLEL_SSH}

GNU @strong{parallel} defaults to using the @strong{ssh} command for remote
access. This can be overridden with $PARALLEL_SSH, which again can be
overridden with @strong{--ssh}. It can also be set on a per server basis
(see @strong{--sshlogin}).

@item $PARALLEL_SSHHOST
@anchor{$PARALLEL_SSHHOST}

Set by GNU @strong{parallel} and can be used in jobs run by GNU @strong{parallel}.
Remember to quote the $, so it gets evaluated by the correct shell. Or
use @strong{--plus} and @{host@}.

$PARALLEL_SSHHOST is the host part of an sshlogin line. E.g.

@verbatim
  4//usr/bin/specialssh user@host
@end verbatim

becomes:

@verbatim
  host
@end verbatim

@item $PARALLEL_SSHLOGIN
@anchor{$PARALLEL_SSHLOGIN}

Set by GNU @strong{parallel} and can be used in jobs run by GNU @strong{parallel}.
Remember to quote the $, so it gets evaluated by the correct shell. Or
use @strong{--plus} and @{sshlogin@}.

The value is the sshlogin line with number of threads removed. E.g.

@verbatim
  4//usr/bin/specialssh user@host
@end verbatim

becomes:

@verbatim
  /usr/bin/specialssh user@host
@end verbatim

@item $PARALLEL_SEQ
@anchor{$PARALLEL_SEQ}

Set by GNU @strong{parallel} and can be used in jobs run by GNU @strong{parallel}.
Remember to quote the $, so it gets evaluated by the correct shell.

$PARALLEL_SEQ is the sequence number of the job running.

@strong{Example:}

@verbatim
  seq 10 | parallel -N2 \
    echo seq:'$'PARALLEL_SEQ arg1:{1} arg2:{2}
@end verbatim

@{#@} is a shorthand for $PARALLEL_SEQ.

@item $PARALLEL_TMUX
@anchor{$PARALLEL_TMUX}

Path to @strong{tmux}. If unset the @strong{tmux} in $PATH is used.

@item $TMPDIR
@anchor{$TMPDIR}

Directory for temporary files.

See also: @strong{--tmpdir}

@item $PARALLEL_REMOTE_TMPDIR
@anchor{$PARALLEL_REMOTE_TMPDIR}

Directory for temporary files on remote servers.

See also: @strong{--tmpdir}

@item $PARALLEL
@anchor{$PARALLEL}

The environment variable $PARALLEL will be used as default options for
GNU @strong{parallel}. If the variable contains special shell characters
(e.g. $, *, or space) then these need to be to be escaped with \.

@strong{Example:}

@verbatim
  cat list | parallel -j1 -k -v ls
  cat list | parallel -j1 -k -v -S"myssh user@server" ls
@end verbatim

can be written as:

@verbatim
  cat list | PARALLEL="-kvj1" parallel ls
  cat list | PARALLEL='-kvj1 -S myssh\ user@server' \
    parallel echo
@end verbatim

Notice the \ after 'myssh' is needed because 'myssh' and 'user@@server'
must be one argument.

See also: @strong{--profile}

@end table

@node DEFAULT PROFILE (CONFIG FILE)
@chapter DEFAULT PROFILE (CONFIG FILE)

The global configuration file /etc/parallel/config, followed by user
configuration file ~/.parallel/config (formerly known as .parallelrc)
will be read in turn if they exist.  Lines starting with '#' will be
ignored. The format can follow that of the environment variable
$PARALLEL, but it is often easier to simply put each option on its own
line.

Options on the command line take precedence, followed by the
environment variable $PARALLEL, user configuration file
~/.parallel/config, and finally the global configuration file
/etc/parallel/config.

Note that no file that is read for options, nor the environment
variable $PARALLEL, may contain retired options such as @strong{--tollef}.

@node PROFILE FILES
@chapter PROFILE FILES

If @strong{--profile} set, GNU @strong{parallel} will read the profile from that
file rather than the global or user configuration files. You can have
multiple @strong{--profiles}.

Profiles are searched for in @strong{~/.parallel}. If the name starts with
@strong{/} it is seen as an absolute path. If the name starts with @strong{./} it
is seen as a relative path from current dir.

Example: Profile for running a command on every sshlogin in
~/.ssh/sshlogins and prepend the output with the sshlogin:

@verbatim
  echo --tag -S .. --nonall > ~/.parallel/nonall_profile
  parallel -J nonall_profile uptime
@end verbatim

Example: Profile for running every command with @strong{-j-1} and @strong{nice}

@verbatim
  echo -j-1 nice > ~/.parallel/nice_profile
  parallel -J nice_profile bzip2 -9 ::: *
@end verbatim

Example: Profile for running a perl script before every command:

@verbatim
  echo "perl -e '\$a=\$\$; print \$a,\" \",'\$PARALLEL_SEQ',\" \";';" \
    > ~/.parallel/pre_perl
  parallel -J pre_perl echo ::: *
@end verbatim

Note how the $ and " need to be quoted using \.

Example: Profile for running distributed jobs with @strong{nice} on the
remote computers:

@verbatim
  echo -S .. nice > ~/.parallel/dist
  parallel -J dist --trc {.}.bz2 bzip2 -9 ::: *
@end verbatim

@node EXIT STATUS
@chapter EXIT STATUS

Exit status depends on @strong{--halt-on-error} if one of these is used:
success=X, success=Y%, fail=Y%.

@table @asis
@item 0
@anchor{0 3}

All jobs ran without error. If success=X is used: X jobs ran without
error. If success=Y% is used: Y% of the jobs ran without error.

@item 1-100
@anchor{1-100}

Some of the jobs failed. The exit status gives the number of failed
jobs. If Y% is used the exit status is the percentage of jobs that
failed.

@item 101
@anchor{101}

More than 100 jobs failed.

@item 255
@anchor{255}

Other error.

@item -1 (In joblog and SQL table)
@anchor{-1 (In joblog and SQL table)}

Killed by Ctrl-C, timeout, not enough memory or similar.

@item -2 (In joblog and SQL table)
@anchor{-2 (In joblog and SQL table)}

skip() was called in @strong{@{= =@}}.

@item -1000 (In SQL table)
@anchor{-1000 (In SQL table)}

Job is ready to run (set by --sqlmaster).

@item -1220 (In SQL table)
@anchor{-1220 (In SQL table)}

Job is taken by worker (set by --sqlworker).

@end table

If fail=1 is used, the exit status will be the exit status of the
failing job.

@node DIFFERENCES BETWEEN GNU Parallel AND ALTERNATIVES
@chapter DIFFERENCES BETWEEN GNU Parallel AND ALTERNATIVES

See: @strong{man parallel_alternatives}

@node BUGS
@chapter BUGS

@menu
* Quoting of newline::
* Speed::
* --nice limits command length::
* Aliases and functions do not work::
* Database with MySQL fails randomly::
@end menu

@node Quoting of newline
@section Quoting of newline

Because of the way newline is quoted this will not work:

@verbatim
  echo 1,2,3 | parallel -vkd, "echo 'a{}b'"
@end verbatim

However, these will all work:

@verbatim
  echo 1,2,3 | parallel -vkd, echo a{}b
  echo 1,2,3 | parallel -vkd, "echo 'a'{}'b'"
  echo 1,2,3 | parallel -vkd, "echo 'a'"{}"'b'"
@end verbatim

@node Speed
@section Speed

@menu
* Startup::
* Job startup::
* SSH::
* Disk access::
@end menu

@node Startup
@subsection Startup

GNU @strong{parallel} is slow at starting up - around 250 ms the first time
and 150 ms after that.

@node Job startup
@subsection Job startup

Starting a job on the local machine takes around 3-10 ms. This can be
a big overhead if the job takes very few ms to run. Often you can
group small jobs together using @strong{-X} which will make the overhead
less significant. Or you can run multiple GNU @strong{parallel}s as
described in @strong{EXAMPLE: Speeding up fast jobs}.

@node SSH
@subsection SSH

When using multiple computers GNU @strong{parallel} opens @strong{ssh} connections
to them to figure out how many connections can be used reliably
simultaneously (Namely SSHD's MaxStartups). This test is done for each
host in serial, so if your @strong{--sshloginfile} contains many hosts it may
be slow.

If your jobs are short you may see that there are fewer jobs running
on the remote systems than expected. This is due to time spent logging
in and out. @strong{-M} may help here.

@node Disk access
@subsection Disk access

A single disk can normally read data faster if it reads one file at a
time instead of reading a lot of files in parallel, as this will avoid
disk seeks. However, newer disk systems with multiple drives can read
faster if reading from multiple files in parallel.

If the jobs are of the form read-all-compute-all-write-all, so
everything is read before anything is written, it may be faster to
force only one disk access at the time:

@verbatim
  sem --id diskio cat file | compute | sem --id diskio cat > file
@end verbatim

If the jobs are of the form read-compute-write, so writing starts
before all reading is done, it may be faster to force only one reader
and writer at the time:

@verbatim
  sem --id read cat file | compute | sem --id write cat > file
@end verbatim

If the jobs are of the form read-compute-read-compute, it may be
faster to run more jobs in parallel than the system has CPUs, as some
of the jobs will be stuck waiting for disk access.

@node --nice limits command length
@section --nice limits command length

The current implementation of @strong{--nice} is too pessimistic in the max
allowed command length. It only uses a little more than half of what
it could. This affects @strong{-X} and @strong{-m}. If this becomes a real problem for
you, file a bug-report.

@node Aliases and functions do not work
@section Aliases and functions do not work

If you get:

@verbatim
  Can't exec "command": No such file or directory
@end verbatim

or:

@verbatim
  open3: exec of by command failed
@end verbatim

or:

@verbatim
  /bin/bash: command: command not found
@end verbatim

it may be because @emph{command} is not known, but it could also be
because @emph{command} is an alias or a function. If it is a function you
need to @strong{export -f} the function first or use @strong{env_parallel}. An
alias will only work if you use @strong{env_parallel}.

@node Database with MySQL fails randomly
@section Database with MySQL fails randomly

The @strong{--sql*} options may fail randomly with MySQL. This problem does
not exist with PostgreSQL.

@node REPORTING BUGS
@chapter REPORTING BUGS

Report bugs to <parallel@@gnu.org> or
https://savannah.gnu.org/bugs/?func=additem&group=parallel

When you write your report, please keep in mind, that you must give
the reader enough information to be able to run exactly what you
run. So you need to include all data and programs that you use to
show the problem.

See a perfect bug report on
https://lists.gnu.org/archive/html/bug-parallel/2015-01/msg00000.html

Your bug report should always include:

@itemize
@item The error message you get (if any). If the error message is not from
GNU @strong{parallel} you need to show why you think GNU @strong{parallel} caused
this.

@item The complete output of @strong{parallel --version}. If you are not running
the latest released version (see https://ftp.gnu.org/gnu/parallel/) you
should specify why you believe the problem is not fixed in that
version.

@item A minimal, complete, and verifiable example (See description on
https://stackoverflow.com/help/mcve).

It should be a complete example that others can run which shows the
problem including all files needed to run the example. This should
preferably be small and simple, so try to remove as many options as
possible.

A combination of @strong{yes}, @strong{seq}, @strong{cat}, @strong{echo}, @strong{wc}, and @strong{sleep}
can reproduce most errors.

If your example requires large files, see if you can make them with
something like @strong{seq 100000000} > @strong{bigfile} or @strong{yes | head -n
1000000000} > @strong{file}. If you need multiple columns: @strong{paste <(seq
1000) <(seq 1000 1999)}

If your example requires remote execution, see if you can use
@strong{localhost} - maybe using another login.

If you have access to a different system (maybe a VirtualBox on your
own machine), test if your MCVE shows the problem on that system. If
it does not, read below.

@item The output of your example. If your problem is not easily reproduced
by others, the output might help them figure out the problem.

@item Whether you have watched the intro videos
(https://www.youtube.com/playlist?list=PL284C9FF2488BC6D1), walked
through the tutorial (man parallel_tutorial), and read the examples
(man parallel_examples).

@end itemize

@menu
* Bug dependent on environment::
* In summary::
@end menu

@node Bug dependent on environment
@section Bug dependent on environment

If you suspect the error is dependent on your environment or
distribution, please see if you can reproduce the error on one of
these VirtualBox images:
https://sourceforge.net/projects/virtualboximage/files/
https://www.osboxes.org/virtualbox-images/

Specifying the name of your distribution is not enough as you may have
installed software that is not in the VirtualBox images.

If you cannot reproduce the error on any of the VirtualBox images
above, see if you can build a VirtualBox image on which you can
reproduce the error. If not you should assume the debugging will be
done through you. That will put a lot more burden on you and it is
extra important you give any information that help. In general the
problem will be fixed faster and with much less work for you if you
can reproduce the error on a VirtualBox - even if you have to build a
VirtualBox image.

@node In summary
@section In summary

Your report must include:

@itemize
@item @strong{parallel --version}

@item output + error message

@item full example including all files

@item VirtualBox image, if you cannot reproduce it on other systems

@end itemize

@node AUTHOR
@chapter AUTHOR

When using GNU @strong{parallel} for a publication please cite:

O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login:
The USENIX Magazine, February 2011:42-47.

This helps funding further development; and it won't cost you a cent.
If you pay 10000 EUR you should feel free to use GNU Parallel without citing.

Copyright (C) 2007-10-18 Ole Tange, http://ole.tange.dk

Copyright (C) 2008-2010 Ole Tange, http://ole.tange.dk

Copyright (C) 2010-2023 Ole Tange, http://ole.tange.dk and Free
Software Foundation, Inc.

Parts of the manual concerning @strong{xargs} compatibility is inspired by
the manual of @strong{xargs} from GNU findutils 4.4.2.

@node LICENSE
@chapter LICENSE

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
at your option any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.

@menu
* Documentation license I::
* Documentation license II::
@end menu

@node Documentation license I
@section Documentation license I

Permission is granted to copy, distribute and/or modify this
documentation under the terms of the GNU Free Documentation License,
Version 1.3 or any later version published by the Free Software
Foundation; with no Invariant Sections, with no Front-Cover Texts, and
with no Back-Cover Texts.  A copy of the license is included in the
file LICENSES/GFDL-1.3-or-later.txt.

@node Documentation license II
@section Documentation license II

You are free:

@table @asis
@item @strong{to Share}
@anchor{@strong{to Share}}

to copy, distribute and transmit the work

@item @strong{to Remix}
@anchor{@strong{to Remix}}

to adapt the work

@end table

Under the following conditions:

@table @asis
@item @strong{Attribution}
@anchor{@strong{Attribution}}

You must attribute the work in the manner specified by the author or
licensor (but not in any way that suggests that they endorse you or
your use of the work).

@item @strong{Share Alike}
@anchor{@strong{Share Alike}}

If you alter, transform, or build upon this work, you may distribute
the resulting work only under the same, similar or a compatible
license.

@end table

With the understanding that:

@table @asis
@item @strong{Waiver}
@anchor{@strong{Waiver}}

Any of the above conditions can be waived if you get permission from
the copyright holder.

@item @strong{Public Domain}
@anchor{@strong{Public Domain}}

Where the work or any of its elements is in the public domain under
applicable law, that status is in no way affected by the license.

@item @strong{Other Rights}
@anchor{@strong{Other Rights}}

In no way are any of the following rights affected by the license:

@itemize
@item Your fair dealing or fair use rights, or other applicable
copyright exceptions and limitations;

@item The author's moral rights;

@item Rights other persons may have either in the work itself or in
how the work is used, such as publicity or privacy rights.

@end itemize

@end table

@table @asis
@item @strong{Notice}
@anchor{@strong{Notice}}

For any reuse or distribution, you must make clear to others the
license terms of this work.

@end table

A copy of the full license is included in the file as
LICENCES/CC-BY-SA-4.0.txt

@node DEPENDENCIES
@chapter DEPENDENCIES

GNU @strong{parallel} uses Perl, and the Perl modules Getopt::Long,
IPC::Open3, Symbol, IO::File, POSIX, and File::Temp.

For @strong{--csv} it uses the Perl module Text::CSV.

For remote usage it uses @strong{rsync} with @strong{ssh}.

@node SEE ALSO
@chapter SEE ALSO

@strong{parallel_tutorial}(1), @strong{env_parallel}(1), @strong{parset}(1),
@strong{parsort}(1), @strong{parallel_alternatives}(1), @strong{parallel_design}(7),
@strong{niceload}(1), @strong{sql}(1), @strong{ssh}(1), @strong{ssh-agent}(1), @strong{sshpass}(1),
@strong{ssh-copy-id}(1), @strong{rsync}(1)

@bye
