Difference between revisions of "Parallel"

From wikieduonline
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:
 
* Installation: <code>[[brew install parallel]]</code>
 
* Installation: <code>[[brew install parallel]]</code>
 
* <code>[[parallel --help]]</code>
 
* <code>[[parallel --help]]</code>
 
  
 
== Examples ==
 
== Examples ==
 
  [[aws ec2 describe-regions --query]] "Regions[].{Name:RegionName}" --output text | [[parallel]] "echo {}; [[aws ec2 describe-instances]] --region {}"
 
  [[aws ec2 describe-regions --query]] "Regions[].{Name:RegionName}" --output text | [[parallel]] "echo {}; [[aws ec2 describe-instances]] --region {}"
 
  
 
  your_command | parallel "echo {}; your_command2 {}"
 
  your_command | parallel "echo {}; your_command2 {}"

Latest revision as of 08:58, 16 August 2024

parallel[1] allows the user to execute shell scripts or commands in parallel.

Examples[edit]

aws ec2 describe-regions --query "Regions[].{Name:RegionName}" --output text | parallel "echo {}; aws ec2 describe-instances --region {}"
your_command | parallel "echo {}; your_command2 {}"
ls | parallel git -C {} fetch
ls | parallel git -C {} pull
parallel -j 12 --eta rsync -a {} /mnt/efs/myexample ::: mydest/*

Activities[edit]

Basic[edit]

  1. Execute a command in parallel by ssh in MACHINE1 and MACHINE2 using parallel
  2. Read stackexchange questions about gnu-parallel: https://unix.stackexchange.com/questions/tagged/gnu-parallel?tab=votes&pagesize=50
  3. Install parallel in macOS: brew install parallel can conflict with brew install moreutils

Intermediate[edit]

  1. Review different parallel options such as: --keep-order or -k which keep order in the output. Do not affect order of execution.
  2. Update all your git repositories in a directory in macOS using parallel: ls | parallel git -C {} fetch

Related terms[edit]

See also[edit]

Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.

Source: https://en.wikiversity.org/wiki/Linux/Basic_commands/parallel

Advertising: