par(1)

๐Ÿ’– par โ€” bestie's guide to parallel command processing ๐Ÿ’–

okay so you found par(1) in the General Commands Manual section and you're like "what even is this" โ€” bestie, it's giving parallel command processing, and honestly? iconic. let's go. โœจ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

par [-FHdefiqx] [-c  command] [-l  logfile] [-n #] [-p #] [file
[file...]]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so par takes a list of files and runs a command on them. main character energy fr fr.

The first line of each file begins with a colon (:) or a pound-sign (#). Here's the vibe check:

  • If it's a colon, the remainder of that line is a command to run for each of the subsequent lines. ๐Ÿ’…
  • If it's a pound-sign, then each subsequent line is a (self-contained) command โ€” unless the -c option was specified, in which case the lines become the arguments replacing the braces ({}s) in the -c argument.

The input file may also be specified on stdin, in the format as previously described. no cap. ๐Ÿซถ

In each of the cases where the lines of the file, following the first, are not commands (ie: colon or -c), instances of open-close braces ({}) in the command will be replaced by these values. the way that works is genuinely so satisfying ๐Ÿ˜ญ

For example, an inputfile whose contents is:

: echo {}
a
b
c

run with par like so:

%par -q inputfile

will produce the following output (order will vary โ€” do not come for me about the order, it's parallel, it does what it wants):

b
a
c

The command-line options are as follows:


โœจ OPTIONS โœจ

  • -F โ€” Omit the footer that normally follows the output of each job. bye bye lil footer ๐ŸŽ€
  • -H โ€” Omit the header that normally precedes the output of each job. no intro, we're jumping straight in.
  • -c โ€” Command to be run on each of the arguments following the command-line options, where the first line of the input file(s) begins with a pound-sign (#).
  • -d โ€” Print debugging information on standard error (stderr). Repeat the option up to three times for more verbosity. (so -ddd is max yap mode, and honestly, we love a yapper)
  • -e โ€” Split args by spaces, rather than using sh -c. > Note: -e is incompatible with the -i option. pick a lane bestie ๐Ÿ’€
  • -f โ€” No input file or STDIN, just run a quantity of the command specified with -c.
  • -i โ€” Run commands interactively through (multiple) xterm(1) processes. windows everywhere, very demure, very mindful ๐ŸชŸ
  • -l โ€” Prefix of logfile name, as in prefix.N where N is the par process number ([0..]).

Default: par.log.<time>.[0..]

  • -n N โ€” Number of simultaneous processes.

Default: 3

  • -p N โ€” Pause N seconds between running commands. a lil breather ๐Ÿ˜ฎโ€๐Ÿ’จ
  • -q โ€” Quiet mode. Omit the typical processing logs and do not create the log files from -l, instead the children inherit stdout and stderr from par. -q is mutually exclusive with the -x and -l options and the option appearing last will take precedence. so whoever shows up last wins, periodt ๐Ÿ‘‘
  • -x โ€” View par logs in real-time via an xterm(1). live reaction cam ๐Ÿ”ฅ

๐Ÿ’œ FILES ๐Ÿ’œ

  • par.log.T.N โ€” Log file; where T is the current time in seconds since the epoch and N is the par process number ([0..]).

๐ŸŒˆ HISTORY ๐ŸŒˆ

par was ported from the perl version. It differs in the following manner:

  1. If par receives a HUP/INT/TERM/QUIT signal, it does not print the commands that will not be run.
  2. If par received a HUP/INT/TERM/QUIT signal, it does not exit immediately after sending kill to running jobs. it waits for them to exit so that they are cleaned-up properly. If a second signal is received, it dies immediately. ๐Ÿ˜ญ she said "not twice, bestie."

and that's the whole page, bestie!! this edition of the manual was served up on 29 July 2019, and it's par(1) from the General Commands Manual โ€” so if anyone asks where you learned all this, you can say the source material was dated and you still ate. ๐Ÿ’…โœจ stay parallel, stay slay. ๐Ÿซถ

๐Ÿ“ฆ where this page comes from