<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>scior</author_name>
  <author_url>https://blog.hatena.ne.jp/scior/</author_url>
  <blog_title>しおメモ</blog_title>
  <blog_url>https://scior.hatenablog.com/</blog_url>
  <categories>
    <anon>shell</anon>
    <anon>メモ</anon>
    <anon>Imagemagick</anon>
  </categories>
  <description>シェルだけで簡単にコマンドを並列実行するのに、xargsの-Pオプションがあります。 GNU Parallelも便利ですが、そちらはmacユーザーだと別途インストールが必要なので、こちらを紹介します。 使い方 活用例 例1. 一括画像リサイズ 例2. 連番ダミー画像生成 例3. 動画の変換 おわりに 使い方 xargs -Pn -Pで並列実行の最大のプロセス数を指定します。 GNU版の場合、-P0で自動で最大限のプロセスを指定してくれますが、macなどBSD版の場合、n&gt;0の制約がついています。 活用例 例1. 一括画像リサイズ find . -type f -name &quot;*.jpg&quot; | x…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fscior.hatenablog.com%2Fentry%2F2019%2F01%2F21%2F212910&quot; title=&quot;xargsの-Pオプションでコマンドを並列実行する - しおメモ&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2019-01-21 21:29:10</published>
  <title>xargsの-Pオプションでコマンドを並列実行する</title>
  <type>rich</type>
  <url>https://scior.hatenablog.com/entry/2019/01/21/212910</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
