Difference between revisions of "Parallel"

From wikieduonline
Jump to navigation Jump to search
(Created page with "<code>parallel</code><ref>https://www.gnu.org/software/parallel/man.html</ref> allows the user to execute shell scripts or commands in parallel. ==...")
 
 
(45 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<code>[[wikipedia:GNU_parallel|parallel]]</code><ref>https://www.gnu.org/software/parallel/man.html</ref> allows the user to execute shell scripts or commands in parallel.
+
{{lowercase}}
 +
<code>[[wikipedia:GNU_parallel|parallel]]</code><ref>https://www.gnu.org/software/parallel/man.html</ref> allows the user to execute shell scripts or [[commands]] in parallel.
 +
 
 +
* Installation: <code>[[brew install parallel]]</code>
 +
* <code>[[parallel --help]]</code>
 +
 
 +
== Examples ==
 +
[[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 {} [[git fetch|fetch]]
 +
ls | parallel git -C {} [[git pull|pull]]
 +
 
 +
[[parallel -j]] 12 [[--eta]] [[rsync -a]] {} /mnt/efs/myexample ::: mydest/*
  
 
== Activities ==
 
== Activities ==
 
=== Basic ===
 
=== Basic ===
# [[/Execute a command in parallel by ssh/]] in MACHINE1 and MACHINE2 using parallel
+
# [[Execute a command in parallel by ssh]] in MACHINE1 and MACHINE2 using parallel
 
# Read stackexchange questions about gnu-parallel: https://unix.stackexchange.com/questions/tagged/gnu-parallel?tab=votes&pagesize=50
 
# Read stackexchange questions about gnu-parallel: https://unix.stackexchange.com/questions/tagged/gnu-parallel?tab=votes&pagesize=50
# Install parallel in macOS: <code>brew install parallel</code> can conflict with <code>brew install moreutils</code>
+
# Install parallel in macOS: <code>[[brew install parallel]]</code> can conflict with <code>[[brew install moreutils]]</code>
  
 
=== Intermediate ===
 
=== Intermediate ===
 
# Review different parallel options such as: <code>--keep-order</code> or <code>-k</code> which keep order in the output. Do not affect order of execution.
 
# Review different parallel options such as: <code>--keep-order</code> or <code>-k</code> which keep order in the output. Do not affect order of execution.
# Update all your [[version Control/Git|git]] repositories in a directory in macOS using parallel: <code>ls | parallel git -C {} fetch </code>
+
# Update all your <code>[[git]]</code> repositories in a directory in macOS using parallel: <code>ls | parallel git -C {} fetch </code>
 +
 
 +
== Related terms ==
 +
* [[Parallels]]
 +
* <code>[[for]]</code>
 +
* <code>[[pssh]]</code>
 +
* <code>[[parallel --citation]]</code>
 +
* <code>[[yarn workspaces foreach]] --paralell</code>
 +
* [[PostgreSQL parallel query]]
 +
* [[Android parallel apps]]
 +
* [[Parallel computing]]
 +
* [[ansible -B]], [[--background]]
 +
* [[parallel --sshlogin]]
 +
* [[pigz]], [[gipz]] parallel implementation
  
 
== See also ==
 
== See also ==
* [[xargs]]
+
* {{parallel}}
* [[moreutils]] package
+
* {{xargs}}
 +
* <code>{{moreutils}}</code>
 +
* {{stress}}
 +
* {{CPU}}
  
 
[[Category:Linux]]
 
[[Category:Linux]]

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: