/usr/share/doc/parallel/parallel.html is in parallel 20141022+ds1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 | <?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GNU Parallel</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a>
<ul>
<li><a href="#Readers-guide">Reader's guide</a></li>
</ul>
</li>
<li><a href="#OPTIONS">OPTIONS</a></li>
<li><a href="#EXAMPLE:-Working-as-xargs--n1.-Argument-appending">EXAMPLE: Working as xargs -n1. Argument appending</a></li>
<li><a href="#EXAMPLE:-Reading-arguments-from-command-line">EXAMPLE: Reading arguments from command line</a></li>
<li><a href="#EXAMPLE:-Inserting-multiple-arguments">EXAMPLE: Inserting multiple arguments</a></li>
<li><a href="#EXAMPLE:-Context-replace">EXAMPLE: Context replace</a></li>
<li><a href="#EXAMPLE:-Compute-intensive-jobs-and-substitution">EXAMPLE: Compute intensive jobs and substitution</a></li>
<li><a href="#EXAMPLE:-Substitution-and-redirection">EXAMPLE: Substitution and redirection</a></li>
<li><a href="#EXAMPLE:-Composed-commands">EXAMPLE: Composed commands</a></li>
<li><a href="#EXAMPLE:-Calling-Bash-functions">EXAMPLE: Calling Bash functions</a></li>
<li><a href="#EXAMPLE:-Function-tester">EXAMPLE: Function tester</a></li>
<li><a href="#EXAMPLE:-Removing-file-extension-when-processing-files">EXAMPLE: Removing file extension when processing files</a></li>
<li><a href="#EXAMPLE:-Removing-two-file-extensions-when-processing-files">EXAMPLE: Removing two file extensions when processing files</a></li>
<li><a href="#EXAMPLE:-Download-10-images-for-each-of-the-past-30-days">EXAMPLE: Download 10 images for each of the past 30 days</a></li>
<li><a href="#EXAMPLE:-Copy-files-as-last-modified-date-ISO8601-with-added-random-digits">EXAMPLE: Copy files as last modified date (ISO8601) with added random digits</a></li>
<li><a href="#EXAMPLE:-Digtal-clock-with-blinking">EXAMPLE: Digtal clock with "blinking" :</a></li>
<li><a href="#EXAMPLE:-Aggregating-content-of-files">EXAMPLE: Aggregating content of files</a></li>
<li><a href="#EXAMPLE:-Breadth-first-parallel-web-crawler-mirrorer">EXAMPLE: Breadth first parallel web crawler/mirrorer</a></li>
<li><a href="#EXAMPLE:-Process-files-from-a-tar-file-while-unpacking">EXAMPLE: Process files from a tar file while unpacking</a></li>
<li><a href="#EXAMPLE:-Rewriting-a-for-loop-and-a-while-read-loop">EXAMPLE: Rewriting a for-loop and a while-read-loop</a></li>
<li><a href="#EXAMPLE:-Rewriting-nested-for-loops">EXAMPLE: Rewriting nested for-loops</a></li>
<li><a href="#EXAMPLE:-Finding-the-lowest-difference-between-files">EXAMPLE: Finding the lowest difference between files</a></li>
<li><a href="#EXAMPLE:-for-loops-with-column-names">EXAMPLE: for-loops with column names</a></li>
<li><a href="#EXAMPLE:-Count-the-differences-between-all-files-in-a-dir">EXAMPLE: Count the differences between all files in a dir</a></li>
<li><a href="#EXAMPLE:-Speeding-up-fast-jobs">EXAMPLE: Speeding up fast jobs</a></li>
<li><a href="#EXAMPLE:-Using-shell-variables">EXAMPLE: Using shell variables</a></li>
<li><a href="#EXAMPLE:-Group-output-lines">EXAMPLE: Group output lines</a></li>
<li><a href="#EXAMPLE:-Tag-output-lines">EXAMPLE: Tag output lines</a></li>
<li><a href="#EXAMPLE:-Keep-order-of-output-same-as-order-of-input">EXAMPLE: Keep order of output same as order of input</a></li>
<li><a href="#EXAMPLE:-Parallel-grep">EXAMPLE: Parallel grep</a></li>
<li><a href="#EXAMPLE:-Grepping-n-lines-for-m-regular-expressions">EXAMPLE: Grepping n lines for m regular expressions.</a></li>
<li><a href="#EXAMPLE:-Using-remote-computers">EXAMPLE: Using remote computers</a></li>
<li><a href="#EXAMPLE:-Transferring-of-files">EXAMPLE: Transferring of files</a></li>
<li><a href="#EXAMPLE:-Distributing-work-to-local-and-remote-computers">EXAMPLE: Distributing work to local and remote computers</a></li>
<li><a href="#EXAMPLE:-Running-the-same-command-on-remote-computers">EXAMPLE: Running the same command on remote computers</a></li>
<li><a href="#EXAMPLE:-Parallelizing-rsync">EXAMPLE: Parallelizing rsync</a></li>
<li><a href="#EXAMPLE:-Use-multiple-inputs-in-one-command">EXAMPLE: Use multiple inputs in one command</a></li>
<li><a href="#EXAMPLE:-Use-a-table-as-input">EXAMPLE: Use a table as input</a></li>
<li><a href="#EXAMPLE:-Run-the-same-command-10-times">EXAMPLE: Run the same command 10 times</a></li>
<li><a href="#EXAMPLE:-Working-as-cat-sh.-Resource-inexpensive-jobs-and-evaluation">EXAMPLE: Working as cat | sh. Resource inexpensive jobs and evaluation</a></li>
<li><a href="#EXAMPLE:-Processing-a-big-file-using-more-cores">EXAMPLE: Processing a big file using more cores</a></li>
<li><a href="#EXAMPLE:-Running-more-than-250-jobs-workaround">EXAMPLE: Running more than 250 jobs workaround</a></li>
<li><a href="#EXAMPLE:-Working-as-mutex-and-counting-semaphore">EXAMPLE: Working as mutex and counting semaphore</a></li>
<li><a href="#EXAMPLE:-Start-editor-with-filenames-from-stdin-standard-input">EXAMPLE: Start editor with filenames from stdin (standard input)</a></li>
<li><a href="#EXAMPLE:-Running-sudo">EXAMPLE: Running sudo</a></li>
<li><a href="#EXAMPLE:-GNU-Parallel-as-queue-system-batch-manager">EXAMPLE: GNU Parallel as queue system/batch manager</a></li>
<li><a href="#EXAMPLE:-GNU-Parallel-as-dir-processor">EXAMPLE: GNU Parallel as dir processor</a></li>
<li><a href="#QUOTING">QUOTING</a></li>
<li><a href="#LIST-RUNNING-JOBS">LIST RUNNING JOBS</a></li>
<li><a href="#COMPLETE-RUNNING-JOBS-BUT-DO-NOT-START-NEW-JOBS">COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS</a></li>
<li><a href="#ENVIRONMENT-VARIABLES">ENVIRONMENT VARIABLES</a></li>
<li><a href="#DEFAULT-PROFILE-CONFIG-FILE">DEFAULT PROFILE (CONFIG FILE)</a></li>
<li><a href="#PROFILE-FILES">PROFILE FILES</a></li>
<li><a href="#EXIT-STATUS">EXIT STATUS</a></li>
<li><a href="#DIFFERENCES-BETWEEN-GNU-Parallel-AND-ALTERNATIVES">DIFFERENCES BETWEEN GNU Parallel AND ALTERNATIVES</a>
<ul>
<li><a href="#SUMMARY-TABLE">SUMMARY TABLE</a></li>
<li><a href="#DIFFERENCES-BETWEEN-xargs-AND-GNU-Parallel">DIFFERENCES BETWEEN xargs AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-find--exec-AND-GNU-Parallel">DIFFERENCES BETWEEN find -exec AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-make--j-AND-GNU-Parallel">DIFFERENCES BETWEEN make -j AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-ppss-AND-GNU-Parallel">DIFFERENCES BETWEEN ppss AND GNU Parallel</a>
<ul>
<li><a href="#EXAMPLES-FROM-ppss-MANUAL">EXAMPLES FROM ppss MANUAL</a></li>
</ul>
</li>
<li><a href="#DIFFERENCES-BETWEEN-pexec-AND-GNU-Parallel">DIFFERENCES BETWEEN pexec AND GNU Parallel</a>
<ul>
<li><a href="#EXAMPLES-FROM-pexec-MANUAL">EXAMPLES FROM pexec MANUAL</a></li>
</ul>
</li>
<li><a href="#DIFFERENCES-BETWEEN-xjobs-AND-GNU-Parallel">DIFFERENCES BETWEEN xjobs AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-prll-AND-GNU-Parallel">DIFFERENCES BETWEEN prll AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-dxargs-AND-GNU-Parallel">DIFFERENCES BETWEEN dxargs AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-mdm-middleman-AND-GNU-Parallel">DIFFERENCES BETWEEN mdm/middleman AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-xapply-AND-GNU-Parallel">DIFFERENCES BETWEEN xapply AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-paexec-AND-GNU-Parallel">DIFFERENCES BETWEEN paexec AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-map-AND-GNU-Parallel">DIFFERENCES BETWEEN map AND GNU Parallel</a></li>
<li><a href="#DIFFERENCES-BETWEEN-ladon-AND-GNU-Parallel">DIFFERENCES BETWEEN ladon AND GNU Parallel</a>
<ul>
<li><a href="#EXAMPLES-FROM-ladon-MANUAL">EXAMPLES FROM ladon MANUAL</a></li>
</ul>
</li>
<li><a href="#DIFFERENCES-BETWEEN-ClusterSSH-AND-GNU-Parallel">DIFFERENCES BETWEEN ClusterSSH AND GNU Parallel</a></li>
</ul>
</li>
<li><a href="#BUGS">BUGS</a>
<ul>
<li><a href="#Quoting-of-newline">Quoting of newline</a></li>
<li><a href="#Speed">Speed</a>
<ul>
<li><a href="#Startup">Startup</a></li>
<li><a href="#Job-startup">Job startup</a></li>
<li><a href="#SSH">SSH</a></li>
<li><a href="#Disk-access">Disk access</a></li>
</ul>
</li>
<li><a href="#nice-limits-command-length">--nice limits command length</a></li>
<li><a href="#Aliases-and-functions-do-not-work">Aliases and functions do not work</a></li>
</ul>
</li>
<li><a href="#REPORTING-BUGS">REPORTING BUGS</a></li>
<li><a href="#AUTHOR">AUTHOR</a></li>
<li><a href="#LICENSE">LICENSE</a>
<ul>
<li><a href="#Documentation-license-I">Documentation license I</a></li>
<li><a href="#Documentation-license-II">Documentation license II</a></li>
</ul>
</li>
<li><a href="#DEPENDENCIES">DEPENDENCIES</a></li>
<li><a href="#SEE-ALSO">SEE ALSO</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>parallel - build and execute shell command lines from standard input in parallel</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<p><b>parallel</b> [options] [<i>command</i> [arguments]] < list_of_arguments</p>
<p><b>parallel</b> [options] [<i>command</i> [arguments]] ( <b>:::</b> arguments | <b>::::</b> argfile(s) ) ...</p>
<p><b>parallel</b> --semaphore [options] <i>command</i></p>
<p><b>#!/usr/bin/parallel</b> --shebang [options] [<i>command</i> [arguments]]</p>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>GNU <b>parallel</b> 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 <b>parallel</b> can then split the input into blocks and pipe a block into each command in parallel.</p>
<p>If you use xargs and tee today you will find GNU <b>parallel</b> very easy to use as GNU <b>parallel</b> is written to have the same options as xargs. If you write loops in shell, you will find GNU <b>parallel</b> may be able to replace most of the loops and make them run faster by running several jobs in parallel.</p>
<p>GNU <b>parallel</b> 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 <b>parallel</b> as input for other programs.</p>
<p>For each line of input GNU <b>parallel</b> will execute <i>command</i> with the line as arguments. If no <i>command</i> is given, the line of input is executed. Several lines will be run in parallel. GNU <b>parallel</b> can often be used as a substitute for <b>xargs</b> or <b>cat | bash</b>.</p>
<h2 id="Readers-guide">Reader's guide</h2>
<p>Start by watching the intro videos for a quick introduction: http://www.youtube.com/playlist?list=PL284C9FF2488BC6D1</p>
<p>Then look at the <b>EXAMPLE</b>s after the list of <b>OPTIONS</b>. That will give you an idea of what GNU <b>parallel</b> is capable of.</p>
<p>Then spend an hour walking through the tutorial (<b>man parallel_tutorial</b>). Your command line will love you for it.</p>
<p>Finally you may want to look at the rest of this manual if you have special needs not already covered.</p>
<h1 id="OPTIONS">OPTIONS</h1>
<dl>
<dt id="command"><i>command</i></dt>
<dd>
<p>Command to execute. If <i>command</i> or the following arguments contain replacement strings (such as <b>{}</b>) every instance will be substituted with the input.</p>
<p>If <i>command</i> is given, GNU <b>parallel</b> solve the same tasks as <b>xargs</b>. If <i>command</i> is not given GNU <b>parallel</b> will behave similar to <b>cat | sh</b>.</p>
<p>The <i>command</i> must be an executable, a script, a composed command, or a function.</p>
<p>If it is a Bash function you need to <b>export -f</b> the function first. To use aliases copy the full environment as described under <b>--env</b> and use <b>env_parallel</b> instead of <b>parallel</b>.</p>
<p>If it is a zsh function you will need to use this helper function <b>exportf</b> to export and to set $PARALLEL_SHELL to bash:</p>
<pre><code> function exportf (){
export $(echo $1)="`whence -f $1 | sed -e "s/$1 //" `"
}
function my_func(){
echo $1;
echo "hello";
}
exportf my_func
PARALLEL_SHELL=/bin/bash parallel "my_func {}" ::: 1 2</code></pre>
<p>The command cannot contain the character \257 (macron: ¯).</p>
</dd>
<dt id="pod"><b>{}</b></dt>
<dd>
<p>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 <b>-a</b>, <b>:::</b>, or <b>::::</b>.</p>
<p>The replacement string <b>{}</b> can be changed with <b>-I</b>.</p>
<p>If the command line contains no replacement strings then <b>{}</b> will be appended to the command line.</p>
</dd>
<dt id="pod1"><b>{.}</b></dt>
<dd>
<p>Input line without extension. This replacement string will be replaced by the input with the extension removed. If the input line contains <b>.</b> after the last <b>/</b> the last <b>.</b> till the end of the string will be removed and <b>{.}</b> will be replaced with the remaining. E.g. <i>foo.jpg</i> becomes <i>foo</i>, <i>subdir/foo.jpg</i> becomes <i>subdir/foo</i>, <i>sub.dir/foo.jpg</i> becomes <i>sub.dir/foo</i>, <i>sub.dir/bar</i> remains <i>sub.dir/bar</i>. If the input line does not contain <b>.</b> it will remain unchanged.</p>
<p>The replacement string <b>{.}</b> can be changed with <b>--er</b>.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="pod2"><b>{/}</b></dt>
<dd>
<p>Basename of input line. This replacement string will be replaced by the input with the directory part removed.</p>
<p>The replacement string <b>{/}</b> can be changed with <b>--basenamereplace</b>.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="pod3"><b>{//}</b></dt>
<dd>
<p>Dirname of input line. This replacement string will be replaced by the dir of the input line. See <b>dirname</b>(1).</p>
<p>The replacement string <b>{//}</b> can be changed with <b>--dirnamereplace</b>.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="pod4"><b>{/.}</b></dt>
<dd>
<p>Basename of input line without extension. This replacement string will be replaced by the input with the directory and extension part removed. It is a combination of <b>{/}</b> and <b>{.}</b>.</p>
<p>The replacement string <b>{/.}</b> can be changed with <b>--basenameextensionreplace</b>.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="alpha-testing"><b>{#}</b> (alpha testing)</dt>
<dd>
<p>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.</p>
<p>The replacement string <b>{#}</b> can be changed with <b>--seqreplace</b>.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="alpha-testing1"><b>{%}</b> (alpha testing)</dt>
<dd>
<p>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.</p>
<p>The replacement string <b>{%}</b> can be changed with <b>--slotreplace</b>.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="n"><b>{</b><i>n</i><b>}</b></dt>
<dd>
<p>Argument from input source <i>n</i> or the <i>n</i>'th argument. This positional replacement string will be replaced by the input from input source <i>n</i> (when used with <b>-a</b> or <b>::::</b>) or with the <i>n</i>'th argument (when used with <b>-N</b>). If <i>n</i> is negative it refers to the <i>n</i>'th last argument.</p>
<p>To understand replacement strings see <b>{}</b>.</p>
</dd>
<dt id="n1"><b>{</b><i>n</i>.<b>}</b></dt>
<dd>
<p>Argument from input source <i>n</i> or the <i>n</i>'th argument without extension. It is a combination of <b>{</b><i>n</i><b>}</b> and <b>{.}</b>.</p>
<p>This positional replacement string will be replaced by the input from input source <i>n</i> (when used with <b>-a</b> or <b>::::</b>) or with the <i>n</i>'th argument (when used with <b>-N</b>). The input will have the extension removed.</p>
<p>To understand positional replacement strings see <b>{</b><i>n</i><b>}</b>.</p>
</dd>
<dt id="n2"><b>{</b><i>n</i>/<b>}</b></dt>
<dd>
<p>Basename of argument from input source <i>n</i> or the <i>n</i>'th argument. It is a combination of <b>{</b><i>n</i><b>}</b> and <b>{/}</b>.</p>
<p>This positional replacement string will be replaced by the input from input source <i>n</i> (when used with <b>-a</b> or <b>::::</b>) or with the <i>n</i>'th argument (when used with <b>-N</b>). The input will have the directory (if any) removed.</p>
<p>To understand positional replacement strings see <b>{</b><i>n</i><b>}</b>.</p>
</dd>
<dt id="n3"><b>{</b><i>n</i>//<b>}</b></dt>
<dd>
<p>Dirname of argument from input source <i>n</i> or the <i>n</i>'th argument. It is a combination of <b>{</b><i>n</i><b>}</b> and <b>{//}</b>.</p>
<p>This positional replacement string will be replaced by the dir of the input from input source <i>n</i> (when used with <b>-a</b> or <b>::::</b>) or with the <i>n</i>'th argument (when used with <b>-N</b>). See <b>dirname</b>(1).</p>
<p>To understand positional replacement strings see <b>{</b><i>n</i><b>}</b>.</p>
</dd>
<dt id="n4"><b>{</b><i>n</i>/.<b>}</b></dt>
<dd>
<p>Basename of argument from input source <i>n</i> or the <i>n</i>'th argument without extension. It is a combination of <b>{</b><i>n</i><b>}</b>, <b>{/}</b>, and <b>{.}</b>.</p>
<p>This positional replacement string will be replaced by the input from input source <i>n</i> (when used with <b>-a</b> or <b>::::</b>) or with the <i>n</i>'th argument (when used with <b>-N</b>). The input will have the directory (if any) and extension removed.</p>
<p>To understand positional replacement strings see <b>{</b><i>n</i><b>}</b>.</p>
</dd>
<dt id="perl-expression"><b>{=</b><i>perl expression</i><b>=}</b></dt>
<dd>
<p>Replace with calculated <i>perl expression</i>. <b>$_</b> will contain the same as <b>{}</b>. After evaluating <i>perl expression</i> <b>$_</b> will be used as the value. It is recommended to only change $_ but you have full access to all of GNU <b>parallel</b>'s internal functions and data structures.</p>
<p>The <b>{=</b><i>perl expression</i><b>=}</b> must be given as a single string.</p>
<p>See also: <b>--rpl</b> <b>--parens</b></p>
</dd>
<dt id="n-perl-expression"><b>{=</b><i>n</i> <i>perl expression</i><b>=}</b></dt>
<dd>
<p>Positional equivalent to <b>{= perl expression =}</b>. To understand positional replacement strings see <b>{</b><i>n</i><b>}</b>.</p>
<p>See also: <b>{= perl expression =}</b> <b>{</b><i>n</i><b>}</b>.</p>
</dd>
<dt id="arguments"><b>:::</b> <i>arguments</i></dt>
<dd>
<p>Use arguments from the command line as input source instead of stdin (standard input). Unlike other options for GNU <b>parallel</b> <b>:::</b> is placed after the <i>command</i> and before the arguments.</p>
<p>The following are equivalent:</p>
<pre><code> (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"</code></pre>
<p>To avoid treating <b>:::</b> as special use <b>--arg-sep</b> to set the argument separator to something else. See also <b>--arg-sep</b>.</p>
<p>stdin (standard input) will be passed to the first process run.</p>
<p>If multiple <b>:::</b> 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.</p>
<p><b>:::</b> and <b>::::</b> can be mixed. So these are equivalent:</p>
<pre><code> 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</code></pre>
</dd>
<dt id="argfiles"><b>::::</b> <i>argfiles</i></dt>
<dd>
<p>Another way to write <b>-a</b> <i>argfile1</i> <b>-a</b> <i>argfile2</i> ...</p>
<p><b>:::</b> and <b>::::</b> can be mixed.</p>
<p>See <b>-a</b>, <b>:::</b> and <b>--xapply</b>.</p>
</dd>
<dt id="null"><b>--null</b></dt>
<dd>
</dd>
<dt id="pod-0"><b>-0</b></dt>
<dd>
<p>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).</p>
</dd>
<dt id="arg-file-input-file"><b>--arg-file</b> <i>input-file</i></dt>
<dd>
</dd>
<dt id="a-input-file"><b>-a</b> <i>input-file</i></dt>
<dd>
<p>Use <i>input-file</i> 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.</p>
<p>If multiple <b>-a</b> are given, each <i>input-file</i> will be treated as an input source, and all combinations of input sources will be generated. E.g. The file <b>foo</b> contains <b>1 2</b>, the file <b>bar</b> contains <b>a b c</b>. <b>-a foo</b> <b>-a bar</b> 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.</p>
<p>See also <b>--xapply</b> and <b>{</b><i>n</i><b>}</b>.</p>
</dd>
<dt id="arg-file-sep-sep-str"><b>--arg-file-sep</b> <i>sep-str</i></dt>
<dd>
<p>Use <i>sep-str</i> instead of <b>::::</b> as separator string between command and argument files. Useful if <b>::::</b> is used for something else by the command.</p>
<p>See also: <b>::::</b>.</p>
</dd>
<dt id="arg-sep-sep-str"><b>--arg-sep</b> <i>sep-str</i></dt>
<dd>
<p>Use <i>sep-str</i> instead of <b>:::</b> as separator string. Useful if <b>:::</b> is used for something else by the command.</p>
<p>Also useful if you command uses <b>:::</b> but you still want to read arguments from stdin (standard input): Simply change <b>--arg-sep</b> to a string that is not in the command line.</p>
<p>See also: <b>:::</b>.</p>
</dd>
<dt id="bar"><b>--bar</b></dt>
<dd>
<p>Show progress as a progress bar. In the bar is shown: % of jobs completed, estimated seconds left, and number of jobs started.</p>
<p>It is compatible with <b>zenity</b>:</p>
<p>seq 1000 | parallel -j30 --bar '(echo {};sleep 0.1)' 2> >(zenity --progress --auto-kill) | wc</p>
</dd>
<dt id="basefile-file"><b>--basefile</b> <i>file</i></dt>
<dd>
</dd>
<dt id="bf-file"><b>--bf</b> <i>file</i></dt>
<dd>
<p><i>file</i> will be transferred to each sshlogin before a jobs is started. It will be removed if <b>--cleanup</b> is active. The file may be a script to run or some common base data needed for the jobs. Multiple <b>--bf</b> can be specified to transfer more basefiles. The <i>file</i> will be transferred the same way as <b>--transfer</b>.</p>
</dd>
<dt id="basenamereplace-replace-str"><b>--basenamereplace</b> <i>replace-str</i></dt>
<dd>
</dd>
<dt id="bnr-replace-str"><b>--bnr</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of <b>{/}</b> for basename of input line.</p>
</dd>
<dt id="basenameextensionreplace-replace-str"><b>--basenameextensionreplace</b> <i>replace-str</i></dt>
<dd>
</dd>
<dt id="bner-replace-str"><b>--bner</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of <b>{/.}</b> for basename of input line without extension.</p>
</dd>
<dt id="bg"><b>--bg</b></dt>
<dd>
<p>Run command in background thus GNU <b>parallel</b> will not wait for completion of the command before exiting. This is the default if <b>--semaphore</b> is set.</p>
<p>See also: <b>--fg</b>, <b>man sem</b>.</p>
<p>Implies <b>--semaphore</b>.</p>
</dd>
<dt id="bibtex"><b>--bibtex</b></dt>
<dd>
<p>Print the BibTeX entry for GNU <b>parallel</b> and disable citation notice.</p>
</dd>
<dt id="block-size"><b>--block</b> <i>size</i></dt>
<dd>
</dd>
<dt id="block-size-size"><b>--block-size</b> <i>size</i></dt>
<dd>
<p>Size of block in bytes. The size can be postfixed with K, M, G, T, P, k, m, g, t, or p which would multiply the size with 1024, 1048576, 1073741824, 1099511627776, 1125899906842624, 1000, 1000000, 1000000000, 1000000000000, or 1000000000000000 respectively.</p>
<p>GNU <b>parallel</b> tries to meet the block size but can be off by the length of one record. For performance reasons <i>size</i> should be bigger than a single record.</p>
<p><i>size</i> defaults to 1M.</p>
<p>See <b>--pipe</b> for use of this.</p>
</dd>
<dt id="cat"><b>--cat</b></dt>
<dd>
<p>Create a temporary file with content. Normally <b>--pipe</b> will give data to the program on stdin (standard input). With <b>--cat</b> GNU <b>parallel</b> will create a temporary file with the name in {}, so you can do: <b>parallel --pipe --cat wc {}</b>.</p>
<p>See also <b>--fifo</b>.</p>
</dd>
<dt id="cleanup"><b>--cleanup</b></dt>
<dd>
<p>Remove transferred files. <b>--cleanup</b> will remove the transferred files on the remote computer after processing is done.</p>
<pre><code> find log -name '*gz' | parallel \
--sshlogin server.example.com --transfer --return {.}.bz2 \
--cleanup "zcat {} | bzip -9 >{.}.bz2"</code></pre>
<p>With <b>--transfer</b> the file transferred to the remote computer will be removed on the remote computer. Directories created will not be removed - even if they are empty.</p>
<p>With <b>--return</b> the file transferred from the remote computer will be removed on the remote computer. Directories created will not be removed - even if they are empty.</p>
<p><b>--cleanup</b> is ignored when not used with <b>--transfer</b> or <b>--return</b>.</p>
</dd>
<dt id="colsep-regexp"><b>--colsep</b> <i>regexp</i></dt>
<dd>
</dd>
<dt id="C-regexp"><b>-C</b> <i>regexp</i></dt>
<dd>
<p>Column separator. The input will be treated as a table with <i>regexp</i> separating the columns. The n'th column can be access using <b>{</b><i>n</i><b>}</b> or <b>{</b><i>n</i>.<b>}</b>. E.g. <b>{3}</b> is the 3rd column.</p>
<p><b>--colsep</b> implies <b>--trim rl</b>.</p>
<p><i>regexp</i> is a Perl Regular Expression: http://perldoc.perl.org/perlre.html</p>
</dd>
<dt id="compress"><b>--compress</b></dt>
<dd>
<p>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.</p>
<p>GNU <b>parallel</b> will try <b>lzop</b>, <b>pigz</b>, <b>gzip</b>, <b>pbzip2</b>, <b>plzip</b>, <b>bzip2</b>, <b>lzma</b>, <b>lzip</b>, <b>xz</b> in that order, and use the first available.</p>
</dd>
<dt id="compress-program-prg"><b>--compress-program</b> <i>prg</i></dt>
<dd>
</dd>
<dt id="decompress-program-prg"><b>--decompress-program</b> <i>prg</i></dt>
<dd>
<p>Use <i>prg</i> for (de)compressing temporary files. It is assumed that <i>prg -dc</i> will decompress stdin (standard input) to stdout (standard output) unless <b>--decompress-program</b> is given.</p>
</dd>
<dt id="ctrlc"><b>--ctrlc</b></dt>
<dd>
<p>Sends SIGINT to tasks running on remote computers thus killing them.</p>
</dd>
<dt id="delimiter-delim"><b>--delimiter</b> <i>delim</i></dt>
<dd>
</dd>
<dt id="d-delim"><b>-d</b> <i>delim</i></dt>
<dd>
<p>Input items are terminated by the specified character. Quotes and backslash are not special; every character in the input is taken literally. Disables the end-of-file string, which is treated like any other argument. This can be used when the input consists of simply newline-separated items, although it is almost always better to design your program to use --null where this is possible. The specified delimiter may be a single character, a C-style character escape such as \n, or an octal or hexadecimal escape code. Octal and hexadecimal escape codes are understood as for the printf command. Multibyte characters are not supported.</p>
</dd>
<dt id="dirnamereplace-replace-str"><b>--dirnamereplace</b> <i>replace-str</i></dt>
<dd>
</dd>
<dt id="dnr-replace-str"><b>--dnr</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of <b>{//}</b> for dirname of input line.</p>
</dd>
<dt id="E-eof-str"><b>-E</b> <i>eof-str</i></dt>
<dd>
<p>Set the end of file string to eof-str. If the end of file string occurs as a line of input, the rest of the input is ignored. If neither <b>-E</b> nor <b>-e</b> is used, no end of file string is used.</p>
</dd>
<dt id="delay-secs"><b>--delay</b> <i>secs</i></dt>
<dd>
<p>Delay starting next job <i>secs</i> seconds. GNU <b>parallel</b> will pause <i>secs</i> seconds after starting each job. <i>secs</i> can be less than 1 seconds.</p>
</dd>
<dt id="dry-run"><b>--dry-run</b></dt>
<dd>
<p>Print the job to run on stdout (standard output), but do not run the job. Use <b>-v -v</b> to include the ssh/rsync wrapping if the job would be run on a remote computer. Do not count on this literaly, though, as the job may be scheduled on another computer or the local computer if : is in the list.</p>
</dd>
<dt id="eof-eof-str"><b>--eof</b>[=<i>eof-str</i>]</dt>
<dd>
</dd>
<dt id="e-eof-str"><b>-e</b>[<i>eof-str</i>]</dt>
<dd>
<p>This option is a synonym for the <b>-E</b> option. Use <b>-E</b> instead, because it is POSIX compliant for <b>xargs</b> while this option is not. If <i>eof-str</i> is omitted, there is no end of file string. If neither <b>-E</b> nor <b>-e</b> is used, no end of file string is used.</p>
</dd>
<dt id="env-var-alpha-testing"><b>--env</b> <i>var</i> (alpha testing)</dt>
<dd>
<p>Copy environment variable <i>var</i>. This will copy <i>var</i> to the environment that the command is run in. This is especially useful for remote execution.</p>
<p>In Bash <i>var</i> can also be a Bash function - just remember to <b>export -f</b> the function, see <b>command</b>.</p>
<p>The variable '_' is special. It will copy all enviroment variables except for the ones mentioned in ~/.parallel/ignored_vars.</p>
<p>To copy Bash arrays you need an importer function, as Bash arrays cannot be exported:</p>
<pre><code> import_array () {
local func=$1; shift;
export $func='() {
'"$(for arr in $@; do
declare -p $arr|sed '1s/declare -./&g/'
done)"'
}'
}
declare -A assoc='([one]="1" [two]="2")'
declare -a indexed='([0]="one" [1]="two")'
import_array my_importer assoc indexed
parallel --env my_importer \
'my_importer; echo "{}" "${indexed[{}]}" "${assoc[${indexed[{}]}]}"' ::: "${!indexed[@]}"</code></pre>
<p>To copy the full environment use this function (e.g. by putting it in .bashrc):</p>
<pre><code> env_parallel() {
export parallel_bash_environment='() {
'"$(echo "shopt -s expand_aliases 2>/dev/null"; alias;typeset -p | grep -vFf <(readonly; echo GROUPS; echo FUNCNAME; echo DIRSTACK; echo _; echo PIPESTATUS; echo USERNAME) | grep -v BASH_;typeset -f)"'
}'
# Run as: env_parallel [normal parallel options]
`which parallel` "$@"
unset parallel_bash_environment
}
# call as:
env_parallel [normal parallel options]</code></pre>
<p>See also: <b>--record-env</b>.</p>
</dd>
<dt id="eta"><b>--eta</b></dt>
<dd>
<p>Show the estimated number of seconds before finishing. This forces GNU <b>parallel</b> to read all jobs before starting to find the number of jobs. GNU <b>parallel</b> normally only reads the next job to run. Implies <b>--progress</b>.</p>
</dd>
<dt id="fg"><b>--fg</b></dt>
<dd>
<p>Run command in foreground thus GNU <b>parallel</b> will wait for completion of the command before exiting.</p>
<p>See also <b>--bg</b>, <b>man sem</b>.</p>
<p>Implies <b>--semaphore</b>.</p>
</dd>
<dt id="fifo"><b>--fifo</b></dt>
<dd>
<p>Create a temporary fifo with content. Normally <b>--pipe</b> will give data to the program on stdin (standard input). With <b>--fifo</b> GNU <b>parallel</b> will create a temporary fifo with the name in {}, so you can do: <b>parallel --pipe --fifo wc {}</b>.</p>
<p>Beware: If data is not read from the fifo, the job will block forever.</p>
<p>See also <b>--cat</b>.</p>
</dd>
<dt id="filter-hosts"><b>--filter-hosts</b></dt>
<dd>
<p>Remove down hosts. For each remote host: check that login through ssh works. If not: do not use this host.</p>
<p>Currently you can <i>not</i> put <b>--filter-hosts</b> in a profile, $PARALLEL, /etc/parallel/config or similar. This is because GNU <b>parallel</b> uses GNU <b>parallel</b> to compute this, so you will get an infinite loop. This will likely be fixed in a later release.</p>
</dd>
<dt id="gnu"><b>--gnu</b></dt>
<dd>
<p>Behave like GNU <b>parallel</b>. This option historically took precedence over <b>--tollef</b>. The <b>--tollef</b> option is now retired, and therefore may not be used. <b>--gnu</b> is kept for compatibility.</p>
</dd>
<dt id="group"><b>--group</b></dt>
<dd>
<p>Group output. Output from each jobs is grouped together and is only printed when the command is finished. stderr (standard error) first followed by stdout (standard output). This takes some CPU time. In rare situations GNU <b>parallel</b> takes up lots of CPU time and if it is acceptable that the outputs from different commands are mixed together, then disabling grouping with <b>-u</b> can speedup GNU <b>parallel</b> by a factor of 10.</p>
<p><b>--group</b> is the default. Can be reversed with <b>-u</b>.</p>
<p>See also: <b>--line-buffer</b> <b>--ungroup</b></p>
</dd>
<dt id="help"><b>--help</b></dt>
<dd>
</dd>
<dt id="h"><b>-h</b></dt>
<dd>
<p>Print a summary of the options to GNU <b>parallel</b> and exit.</p>
</dd>
<dt id="halt-on-error-val"><b>--halt-on-error</b> <i>val</i></dt>
<dd>
</dd>
<dt id="halt-val"><b>--halt</b> <i>val</i></dt>
<dd>
<p>How should GNU <b>parallel</b> terminate if one of more jobs fail?</p>
<dl>
<dt id="pod0">0</dt>
<dd>
<p>Do not halt if a job fails. Exit status will be the number of jobs failed. This is the default.</p>
</dd>
<dt id="pod11">1</dt>
<dd>
<p>Do not start new jobs if a job fails, but complete the running jobs including cleanup. The exit status will be the exit status from the last failing job.</p>
</dd>
<dt id="pod21">2</dt>
<dd>
<p>Kill off all jobs immediately and exit without cleanup. The exit status will be the exit status from the failing job.</p>
</dd>
<dt id="pod1-99">1-99%</dt>
<dd>
<p>If <i>val</i>% of the jobs fail and minimum 3: Do not start new jobs, but complete the running jobs including cleanup. The exit status will be the exit status from the last failing job.</p>
</dd>
</dl>
</dd>
<dt id="header-regexp"><b>--header</b> <i>regexp</i></dt>
<dd>
<p>Use regexp as header. For normal usage the matched header (typically the first line: <b>--header '.*\n'</b>) will be split using <b>--colsep</b> (which will default to '\t') and column names can be used as replacement variables: <b>{column name}</b>.</p>
<p>For <b>--pipe</b> the matched header will be prepended to each output.</p>
<p><b>--header :</b> is an alias for <b>--header '.*\n'</b>.</p>
<p>If <i>regexp</i> is a number, it will match that many lines.</p>
</dd>
<dt id="I-replace-str"><b>-I</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of {}.</p>
</dd>
<dt id="replace-replace-str"><b>--replace</b>[=<i>replace-str</i>]</dt>
<dd>
</dd>
<dt id="i-replace-str"><b>-i</b>[<i>replace-str</i>]</dt>
<dd>
<p>This option is a synonym for <b>-I</b><i>replace-str</i> if <i>replace-str</i> is specified, and for <b>-I</b>{} otherwise. This option is deprecated; use <b>-I</b> instead.</p>
</dd>
<dt id="joblog-logfile"><b>--joblog</b> <i>logfile</i></dt>
<dd>
<p>Logfile for executed jobs. Save a list of the executed jobs to <i>logfile</i> 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.</p>
<p>To convert the times into ISO-8601 strict do:</p>
<p><b>perl -a -F"\t" -ne 'chomp($F[2]=`date -d \@$F[2] +%FT%T`); print join("\t",@F)'</b></p>
<p>See also <b>--resume</b>.</p>
</dd>
<dt id="jobs-N"><b>--jobs</b> <i>N</i></dt>
<dd>
</dd>
<dt id="j-N"><b>-j</b> <i>N</i></dt>
<dd>
</dd>
<dt id="max-procs-N"><b>--max-procs</b> <i>N</i></dt>
<dd>
</dd>
<dt id="P-N"><b>-P</b> <i>N</i></dt>
<dd>
<p>Number of jobslots. Run up to N jobs in parallel. 0 means as many as possible. Default is 100% which will run one job per CPU core.</p>
<p>If <b>--semaphore</b> is set default is 1 thus making a mutex.</p>
</dd>
<dt id="jobs-N1"><b>--jobs</b> <i>+N</i></dt>
<dd>
</dd>
<dt id="j-N1"><b>-j</b> <i>+N</i></dt>
<dd>
</dd>
<dt id="max-procs-N1"><b>--max-procs</b> <i>+N</i></dt>
<dd>
</dd>
<dt id="P-N1"><b>-P</b> <i>+N</i></dt>
<dd>
<p>Add N to the number of CPU cores. Run this many jobs in parallel. See also <b>--use-cpus-instead-of-cores</b>.</p>
</dd>
<dt id="jobs--N"><b>--jobs</b> <i>-N</i></dt>
<dd>
</dd>
<dt id="j--N"><b>-j</b> <i>-N</i></dt>
<dd>
</dd>
<dt id="max-procs--N"><b>--max-procs</b> <i>-N</i></dt>
<dd>
</dd>
<dt id="P--N"><b>-P</b> <i>-N</i></dt>
<dd>
<p>Subtract N from the number of CPU cores. Run this many jobs in parallel. If the evaluated number is less than 1 then 1 will be used. See also <b>--use-cpus-instead-of-cores</b>.</p>
</dd>
<dt id="jobs-N2"><b>--jobs</b> <i>N</i>%</dt>
<dd>
</dd>
<dt id="j-N2"><b>-j</b> <i>N</i>%</dt>
<dd>
</dd>
<dt id="max-procs-N2"><b>--max-procs</b> <i>N</i>%</dt>
<dd>
</dd>
<dt id="P-N2"><b>-P</b> <i>N</i>%</dt>
<dd>
<p>Multiply N% with the number of CPU cores. Run this many jobs in parallel. See also <b>--use-cpus-instead-of-cores</b>.</p>
</dd>
<dt id="jobs-procfile"><b>--jobs</b> <i>procfile</i></dt>
<dd>
</dd>
<dt id="j-procfile"><b>-j</b> <i>procfile</i></dt>
<dd>
</dd>
<dt id="max-procs-procfile"><b>--max-procs</b> <i>procfile</i></dt>
<dd>
</dd>
<dt id="P-procfile"><b>-P</b> <i>procfile</i></dt>
<dd>
<p>Read parameter from file. Use the content of <i>procfile</i> as parameter for <i>-j</i>. E.g. <i>procfile</i> could contain the string 100% or +2 or 10. If <i>procfile</i> is changed when a job completes, <i>procfile</i> 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 <b>parallel</b> is running.</p>
</dd>
<dt id="keep-order"><b>--keep-order</b></dt>
<dd>
</dd>
<dt id="k"><b>-k</b></dt>
<dd>
<p>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:</p>
<pre><code> parallel -j4 sleep {}\; echo {} ::: 2 1 4 3
parallel -j4 -k sleep {}\; echo {} ::: 2 1 4 3</code></pre>
<p>If used with <b>--onall</b> or <b>--nonall</b> the output will grouped by sshlogin in sorted order.</p>
</dd>
<dt id="L-max-lines"><b>-L</b> <i>max-lines</i></dt>
<dd>
<p>When used with <b>--pipe</b>: Read records of <i>max-lines</i>.</p>
<p>When used otherwise: Use at most <i>max-lines</i> nonblank input lines per command line. Trailing blanks cause an input line to be logically continued on the next input line.</p>
<p><b>-L 0</b> means read one line, but insert 0 arguments on the command line.</p>
<p>Implies <b>-X</b> unless <b>-m</b>, <b>--xargs</b>, or <b>--pipe</b> is set.</p>
</dd>
<dt id="max-lines-max-lines"><b>--max-lines</b>[=<i>max-lines</i>]</dt>
<dd>
</dd>
<dt id="l-max-lines"><b>-l</b>[<i>max-lines</i>]</dt>
<dd>
<p>When used with <b>--pipe</b>: Read records of <i>max-lines</i>.</p>
<p>When used otherwise: Synonym for the <b>-L</b> option. Unlike <b>-L</b>, the <i>max-lines</i> argument is optional. If <i>max-lines</i> is not specified, it defaults to one. The <b>-l</b> option is deprecated since the POSIX standard specifies <b>-L</b> instead.</p>
<p><b>-l 0</b> is an alias for <b>-l 1</b>.</p>
<p>Implies <b>-X</b> unless <b>-m</b>, <b>--xargs</b>, or <b>--pipe</b> is set.</p>
</dd>
<dt id="line-buffer"><b>--line-buffer</b></dt>
<dd>
<p>Buffer output on line basis. <b>--group</b> will keep the output together for a whole job. <b>--ungroup</b> allows output to mixup with half a line coming from one job and half a line coming from another job. <b>--line-buffer</b> fits between these two: GNU <b>parallel</b> will print a full line, but will allow for mixing lines of different jobs.</p>
<p><b>--line-buffer</b> takes more CPU power than than both <b>--group</b> and <b>--ungroup</b>, but can be faster than <b>--group</b> if the CPU is not the limiting factor.</p>
<p>See also: <b>--group</b> <b>--ungroup</b></p>
</dd>
<dt id="load-max-load"><b>--load</b> <i>max-load</i></dt>
<dd>
<p>Do not start new jobs on a given computer unless the number of running processes on the computer is less than <i>max-load</i>. <i>max-load</i> uses the same syntax as <b>--jobs</b>, so <i>100%</i> for one per CPU is a valid setting. Only difference is 0 which is interpreted as 0.01.</p>
</dd>
<dt id="controlmaster"><b>--controlmaster</b></dt>
<dd>
</dd>
<dt id="M"><b>-M</b></dt>
<dd>
<p>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.</p>
</dd>
<dt id="xargs"><b>--xargs</b></dt>
<dd>
<p>Multiple arguments. Insert as many arguments as the command line length permits.</p>
<p>If <b>{}</b> is not used the arguments will be appended to the line. If <b>{}</b> is used multiple times each <b>{}</b> will be replaced with all the arguments.</p>
<p>Support for <b>--xargs</b> with <b>--sshlogin</b> is limited and may fail.</p>
<p>See also <b>-X</b> for context replace. If in doubt use <b>-X</b> as that will most likely do what is needed.</p>
</dd>
<dt id="m"><b>-m</b></dt>
<dd>
<p>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 <b>-j1</b> to avoid this.</p>
<p>If <b>{}</b> is not used the arguments will be appended to the line. If <b>{}</b> is used multiple times each <b>{}</b> will be replaced with all the arguments.</p>
<p>Support for <b>-m</b> with <b>--sshlogin</b> is limited and may fail.</p>
<p>See also <b>-X</b> for context replace. If in doubt use <b>-X</b> as that will most likely do what is needed.</p>
</dd>
<dt id="minversion-version"><b>--minversion</b> <i>version</i></dt>
<dd>
<p>Print the version GNU <b>parallel</b> and exit. If the current version of GNU <b>parallel</b> is less than <i>version</i> the exit code is 255. Otherwise it is 0.</p>
<p>This is useful for scripts that depend on features only available from a certain version of GNU <b>parallel</b>.</p>
</dd>
<dt id="nonall-beta-testing"><b>--nonall</b> (beta testing)</dt>
<dd>
<p><b>--onall</b> with no arguments. Run the command on all computers given with <b>--sshlogin</b> but take no arguments. GNU <b>parallel</b> will log into <b>--jobs</b> number of computers in parallel and run the job on the computer. <b>-j</b> adjusts how many computers to log into in parallel.</p>
<p>This is useful for running the same command (e.g. uptime) on a list of servers.</p>
</dd>
<dt id="onall-beta-testing"><b>--onall</b> (beta testing)</dt>
<dd>
<p>Run all the jobs on all computers given with <b>--sshlogin</b>. GNU <b>parallel</b> will log into <b>--jobs</b> 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. <b>-j</b> adjusts how many computers to log into in parallel.</p>
<p>When using <b>--group</b> the output will be grouped by each server, so all the output from one server will be grouped together.</p>
</dd>
<dt id="output-as-files"><b>--output-as-files</b></dt>
<dd>
</dd>
<dt id="outputasfiles"><b>--outputasfiles</b></dt>
<dd>
</dd>
<dt id="files"><b>--files</b></dt>
<dd>
<p>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.</p>
</dd>
<dt id="pipe"><b>--pipe</b></dt>
<dd>
</dd>
<dt id="spreadstdin"><b>--spreadstdin</b></dt>
<dd>
<p>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.</p>
<p>The block size is determined by <b>--block</b>. The strings <b>--recstart</b> and <b>--recend</b> tell GNU <b>parallel</b> how a record starts and/or ends. The block read will have the final partial record removed before the block is passed on to the job. The partial record will be prepended to next block.</p>
<p>If <b>--recstart</b> is given this will be used to split at record start.</p>
<p>If <b>--recend</b> is given this will be used to split at record end.</p>
<p>If both <b>--recstart</b> and <b>--recend</b> are given both will have to match to find a split position.</p>
<p>If neither <b>--recstart</b> nor <b>--recend</b> are given <b>--recend</b> defaults to '\n'. To have no record separator use <b>--recend ""</b>.</p>
<p><b>--files</b> is often used with <b>--pipe</b>.</p>
<p>See also: <b>--recstart</b>, <b>--recend</b>, <b>--fifo</b>, <b>--cat</b>, <b>--pipepart</b>.</p>
</dd>
<dt id="pipepart-beta-testing"><b>--pipepart</b> (beta testing)</dt>
<dd>
<p>Pipe parts of a physical file. <b>--pipepart</b> works similar to <b>--pipe</b>, but is much faster. It has a few limitations:</p>
<dl>
<dt id="pod5">*</dt>
<dd>
<p>The file must be a physical (seekable) file and must be given using <b>-a</b> or <b>::::</b>.</p>
</dd>
<dt id="pod6">*</dt>
<dd>
<p>Record counting (<b>-N</b>) and line counting (<b>-L</b>/<b>-l</b>) do not work.</p>
</dd>
</dl>
</dd>
<dt id="plain"><b>--plain</b></dt>
<dd>
<p>Ignore any <b>--profile</b>, $PARALLEL, and ~/.parallel/config to get full control on the command line (used by GNU <b>parallel</b> internally when called with <b>--sshlogin</b>).</p>
</dd>
<dt id="plus"><b>--plus</b></dt>
<dd>
<p>Activate additional replacement strings: {+/} {+.} {+..} {+...} {..} {...} {/..} {/...}. The idea being that '{+foo}' matches the opposite of '{foo}' and {} = {+/}/{/} = {.}.{+.} = {+/}/{/.}.{+.} = {..}.{+..} = {+/}/{/..}.{+..} = {...}.{+...} = {+/}/{/...}.{+...}</p>
</dd>
<dt id="progress"><b>--progress</b></dt>
<dd>
<p>Show progress of computations. List the computers involved in the task with number of CPU cores 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 <b>parallel</b> only read the next job when ready to schedule it - this is to avoid wasting time and memory by reading everything at startup.</p>
<p>By sending GNU <b>parallel</b> SIGUSR2 you can toggle turning on/off <b>--progress</b> on a running GNU <b>parallel</b> process.</p>
<p>See also <b>--eta</b>.</p>
</dd>
<dt id="max-args-max-args"><b>--max-args</b>=<i>max-args</i></dt>
<dd>
</dd>
<dt id="n-max-args"><b>-n</b> <i>max-args</i></dt>
<dd>
<p>Use at most <i>max-args</i> arguments per command line. Fewer than <i>max-args</i> arguments will be used if the size (see the <b>-s</b> option) is exceeded, unless the <b>-x</b> option is given, in which case GNU <b>parallel</b> will exit.</p>
<p><b>-n 0</b> means read one argument, but insert 0 arguments on the command line.</p>
<p>Implies <b>-X</b> unless <b>-m</b> is set.</p>
</dd>
<dt id="max-replace-args-max-args"><b>--max-replace-args</b>=<i>max-args</i></dt>
<dd>
</dd>
<dt id="N-max-args"><b>-N</b> <i>max-args</i></dt>
<dd>
<p>Use at most <i>max-args</i> arguments per command line. Like <b>-n</b> but also makes replacement strings <b>{1}</b> .. <b>{</b><i>max-args</i><b>}</b> that represents argument 1 .. <i>max-args</i>. If too few args the <b>{</b><i>n</i><b>}</b> will be empty.</p>
<p><b>-N 0</b> means read one argument, but insert 0 arguments on the command line.</p>
<p>This will set the owner of the homedir to the user:</p>
<p><b>tr ':' '\n' < /etc/passwd | parallel -N7 chown {1} {6}</b></p>
<p>Implies <b>-X</b> unless <b>-m</b> or <b>--pipe</b> is set.</p>
<p>When used with <b>--pipe</b> <b>-N</b> is the number of records to read. This is somewhat slower than <b>--block</b>.</p>
</dd>
<dt id="max-line-length-allowed"><b>--max-line-length-allowed</b></dt>
<dd>
<p>Print the maximal number of characters allowed on the command line and exit (used by GNU <b>parallel</b> itself to determine the line length on remote computers).</p>
</dd>
<dt id="number-of-cpus"><b>--number-of-cpus</b></dt>
<dd>
<p>Print the number of physical CPUs and exit (used by GNU <b>parallel</b> itself to determine the number of physical CPUs on remote computers).</p>
</dd>
<dt id="number-of-cores"><b>--number-of-cores</b></dt>
<dd>
<p>Print the number of CPU cores and exit (used by GNU <b>parallel</b> itself to determine the number of CPU cores on remote computers).</p>
</dd>
<dt id="no-notice"><b>--no-notice</b></dt>
<dd>
<p>Do not display citation notice. A citation notice is printed on stderr (standard error) only if stderr (standard error) is a terminal, the user has not specified <b>--no-notice</b>, and the user has not run <b>--bibtex</b> once.</p>
</dd>
<dt id="nice-niceness"><b>--nice</b> <i>niceness</i></dt>
<dd>
<p>Run the command at this niceness. For simple commands you can just add <b>nice</b> in front of the command. But if the command consists of more sub commands (Like: ls|wc) then prepending <b>nice</b> will not always work. <b>--nice</b> will make sure all sub commands are niced.</p>
</dd>
<dt id="interactive"><b>--interactive</b></dt>
<dd>
</dd>
<dt id="p"><b>-p</b></dt>
<dd>
<p>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 <b>-t</b>.</p>
</dd>
<dt id="parens-parensstring"><b>--parens</b> <i>parensstring</i></dt>
<dd>
<p>Use to define start and end parenthesis for <b>{= perl expression =}</b>. The left and the right parenthesis can be multiple characters and are assumed to be the same length. The default is <b>{==}</b> giving <b>{=</b> as the start parenthesis and <b>=}</b> as the end parenthesis.</p>
<p>Another useful setting is <b>,,,,</b> which would make both parenthesis <b>,,</b>:</p>
<pre><code> parallel --parens ,,,, echo foo is ,,s/I/O/g,, ::: FII</code></pre>
<p>See also: <b>--rpl</b> <b>{= perl expression =}</b></p>
</dd>
<dt id="profile-profilename"><b>--profile</b> <i>profilename</i></dt>
<dd>
</dd>
<dt id="J-profilename"><b>-J</b> <i>profilename</i></dt>
<dd>
<p>Use profile <i>profilename</i> 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. See the section PROFILE FILES for examples.</p>
<p><i>profilename</i> corresponds to the file ~/.parallel/<i>profilename</i>.</p>
<p>You can give multiple profiles by repeating <b>--profile</b>. If parts of the profiles conflict, the later ones will be used.</p>
<p>Default: config</p>
</dd>
<dt id="quote"><b>--quote</b></dt>
<dd>
</dd>
<dt id="q"><b>-q</b></dt>
<dd>
<p>Quote <i>command</i>. This will quote the command line so special characters are not interpreted by the shell. See the section QUOTING. Most people will never need this. Quoting is disabled by default.</p>
</dd>
<dt id="no-run-if-empty"><b>--no-run-if-empty</b></dt>
<dd>
</dd>
<dt id="r"><b>-r</b></dt>
<dd>
<p>If the stdin (standard input) only contains whitespace, do not run the command.</p>
<p>If used with <b>--pipe</b> this is slow.</p>
</dd>
<dt id="noswap"><b>--noswap</b></dt>
<dd>
<p>Do not start new jobs on a given computer if there is both swap-in and swap-out activity.</p>
<p>The swap activity is only sampled every 10 seconds as the sampling takes 1 second to do.</p>
<p>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.</p>
</dd>
<dt id="record-env"><b>--record-env</b></dt>
<dd>
<p>Record current environment variables in ~/.parallel/ignored_vars. This is useful before using <b>--env _</b>.</p>
<p>See also <b>--env</b>.</p>
</dd>
<dt id="recstart-startstring"><b>--recstart</b> <i>startstring</i></dt>
<dd>
</dd>
<dt id="recend-endstring"><b>--recend</b> <i>endstring</i></dt>
<dd>
<p>If <b>--recstart</b> is given <i>startstring</i> will be used to split at record start.</p>
<p>If <b>--recend</b> is given <i>endstring</i> will be used to split at record end.</p>
<p>If both <b>--recstart</b> and <b>--recend</b> are given the combined string <i>endstring</i><i>startstring</i> will have to match to find a split position. This is useful if either <i>startstring</i> or <i>endstring</i> match in the middle of a record.</p>
<p>If neither <b>--recstart</b> nor <b>--recend</b> are given then <b>--recend</b> defaults to '\n'. To have no record separator use <b>--recend ""</b>.</p>
<p><b>--recstart</b> and <b>--recend</b> are used with <b>--pipe</b>.</p>
<p>Use <b>--regexp</b> to interpret <b>--recstart</b> and <b>--recend</b> as regular expressions. This is slow, however.</p>
</dd>
<dt id="regexp"><b>--regexp</b></dt>
<dd>
<p>Use <b>--regexp</b> to interpret <b>--recstart</b> and <b>--recend</b> as regular expressions. This is slow, however.</p>
</dd>
<dt id="remove-rec-sep"><b>--remove-rec-sep</b></dt>
<dd>
</dd>
<dt id="removerecsep"><b>--removerecsep</b></dt>
<dd>
</dd>
<dt id="rrs"><b>--rrs</b></dt>
<dd>
<p>Remove the text matched by <b>--recstart</b> and <b>--recend</b> before piping it to the command.</p>
<p>Only used with <b>--pipe</b>.</p>
</dd>
<dt id="results-prefix"><b>--results</b> <i>prefix</i></dt>
<dd>
</dd>
<dt id="res-prefix"><b>--res</b> <i>prefix</i></dt>
<dd>
<p>Save the output into files. The files will be stored in a directory tree rooted at <i>prefix</i>. Within this directory tree, each command will result in two files: <i>prefix</i>/<ARGS>/stdout and <i>prefix</i>/<ARGS>/stderr, where <ARGS> is a sequence of directories representing the header of the input source (if using <b>--header :</b>) or the number of the input source and corresponding values.</p>
<p>E.g:</p>
<pre><code> parallel --header : --results foo echo {a} {b} ::: a I II ::: b III IIII</code></pre>
<p>will generate the files:</p>
<pre><code> foo/a/I/b/III/stderr
foo/a/I/b/III/stdout
foo/a/I/b/IIII/stderr
foo/a/I/b/IIII/stdout
foo/a/II/b/III/stderr
foo/a/II/b/III/stdout
foo/a/II/b/IIII/stderr
foo/a/II/b/IIII/stdout</code></pre>
<p>and</p>
<pre><code> parallel --results foo echo {1} {2} ::: I II ::: III IIII</code></pre>
<p>will generate the files:</p>
<pre><code> foo/1/I/2/III/stderr
foo/1/I/2/III/stdout
foo/1/I/2/IIII/stderr
foo/1/I/2/IIII/stdout
foo/1/II/2/III/stderr
foo/1/II/2/III/stdout
foo/1/II/2/IIII/stderr
foo/1/II/2/IIII/stdout</code></pre>
<p>See also <b>--files</b>, <b>--header</b>, <b>--joblog</b>.</p>
</dd>
<dt id="resume"><b>--resume</b></dt>
<dd>
<p>Resumes from the last unfinished job. By reading <b>--joblog</b> or the <b>--results</b> dir GNU <b>parallel</b> will figure out the last unfinished job and continue from there. As GNU <b>parallel</b> only looks at the sequence numbers in <b>--joblog</b> then the input, the command, and <b>--joblog</b> all have to remain unchanged; otherwise GNU <b>parallel</b> may run wrong commands.</p>
<p>See also <b>--joblog</b>, <b>--results</b>, <b>--resume-failed</b>.</p>
</dd>
<dt id="resume-failed"><b>--resume-failed</b></dt>
<dd>
<p>Retry all failed and resume from the last unfinished job. By reading <b>--joblog</b> GNU <b>parallel</b> will figure out the failed jobs and run those again. After that it will resume last unfinished job and continue from there. As GNU <b>parallel</b> only looks at the sequence numbers in <b>--joblog</b> then the input, the command, and <b>--joblog</b> all have to remain unchanged; otherwise GNU <b>parallel</b> may run wrong commands.</p>
<p>See also <b>--joblog</b>, <b>--resume</b>.</p>
</dd>
<dt id="retries-n"><b>--retries</b> <i>n</i></dt>
<dd>
<p>If a job fails, retry it on another computer on which it has not failed. Do this <i>n</i> times. If there are fewer than <i>n</i> computers in <b>--sshlogin</b> GNU <b>parallel</b> will re-use all the computers. This is useful if some jobs fail for no apparent reason (such as network failure).</p>
</dd>
<dt id="return-filename"><b>--return</b> <i>filename</i></dt>
<dd>
<p>Transfer files from remote computers. <b>--return</b> is used with <b>--sshlogin</b> when the arguments are files on the remote computers. When processing is done the file <i>filename</i> will be transferred from the remote computer using <b>rsync</b> and will be put relative to the default login dir. E.g.</p>
<pre><code> echo foo/bar.txt | parallel \
--sshlogin server.example.com --return {.}.out touch {.}.out</code></pre>
<p>This will transfer the file <i>$HOME/foo/bar.out</i> from the computer <i>server.example.com</i> to the file <i>foo/bar.out</i> after running <b>touch foo/bar.out</b> on <i>server.example.com</i>.</p>
<pre><code> echo /tmp/foo/bar.txt | parallel \
--sshlogin server.example.com --return {.}.out touch {.}.out</code></pre>
<p>This will transfer the file <i>/tmp/foo/bar.out</i> from the computer <i>server.example.com</i> to the file <i>/tmp/foo/bar.out</i> after running <b>touch /tmp/foo/bar.out</b> on <i>server.example.com</i>.</p>
<p>Multiple files can be transferred by repeating the options multiple times:</p>
<pre><code> echo /tmp/foo/bar.txt | \
parallel --sshlogin server.example.com \
--return {.}.out --return {.}.out2 touch {.}.out {.}.out2</code></pre>
<p><b>--return</b> is often used with <b>--transfer</b> and <b>--cleanup</b>.</p>
<p><b>--return</b> is ignored when used with <b>--sshlogin :</b> or when not used with <b>--sshlogin</b>.</p>
</dd>
<dt id="round-robin"><b>--round-robin</b></dt>
<dd>
</dd>
<dt id="round"><b>--round</b></dt>
<dd>
<p>Normally <b>--pipe</b> will give a single block to each instance of the command. With <b>--round-robin</b> all blocks will at random be written to commands already running. This is useful if the command takes a long time to initialize.</p>
<p><b>--keep-order</b> will not work with <b>--round-robin</b> as it is impossible to track which input block corresponds to which output.</p>
</dd>
<dt id="rpl-tag-perl-expression"><b>--rpl</b> '<i>tag</i> <i>perl expression</i>'</dt>
<dd>
<p>Use <i>tag</i> as a replacement string for <i>perl expression</i>. This makes it possible to define your own replacement strings. GNU <b>parallel</b>'s 7 replacement strings are implemented as:</p>
<pre><code> --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:\.[^/.]+$::'</code></pre>
<p>If the user defined replacement string starts with '{' it can also be used as a positional replacement string (like <b>{2.}</b>).</p>
<p>It is recommended to only change $_ but you have full access to all of GNU <b>parallel</b>'s internal functions and data structures.</p>
<p>Here are a few examples:</p>
<pre><code> Remove 2 extensions (e.g. .tar.gz)
--rpl '{..} s:\.[^/.]+$::;s:\.[^/.]+$::;'
Keep only the extension
--rpl '{ext} s:.*\.::'
Is the job sequence even or odd?
--rpl '{odd} $_=$job->seq()%2?"odd":"even"'</code></pre>
<p>See also: <b>{= perl expression =}</b> <b>--parens</b></p>
</dd>
<dt id="max-chars-max-chars"><b>--max-chars</b>=<i>max-chars</i></dt>
<dd>
</dd>
<dt id="s-max-chars"><b>-s</b> <i>max-chars</i></dt>
<dd>
<p>Use at most <i>max-chars</i> 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.</p>
<p>Implies <b>-X</b> unless <b>-m</b> is set.</p>
</dd>
<dt id="show-limits"><b>--show-limits</b></dt>
<dd>
<p>Display the limits on the command-line length which are imposed by the operating system and the <b>-s</b> option. Pipe the input from /dev/null (and perhaps specify --no-run-if-empty) if you don't want GNU <b>parallel</b> to do anything.</p>
</dd>
<dt id="semaphore"><b>--semaphore</b></dt>
<dd>
<p>Work as a counting semaphore. <b>--semaphore</b> will cause GNU <b>parallel</b> to start <i>command</i> in the background. When the number of simultaneous jobs is reached, GNU <b>parallel</b> will wait for one of these to complete before starting another command.</p>
<p><b>--semaphore</b> implies <b>--bg</b> unless <b>--fg</b> is specified.</p>
<p><b>--semaphore</b> implies <b>--semaphorename `tty`</b> unless <b>--semaphorename</b> is specified.</p>
<p>Used with <b>--fg</b>, <b>--wait</b>, and <b>--semaphorename</b>.</p>
<p>The command <b>sem</b> is an alias for <b>parallel --semaphore</b>.</p>
<p>See also <b>man sem</b>.</p>
</dd>
<dt id="semaphorename-name"><b>--semaphorename</b> <i>name</i></dt>
<dd>
</dd>
<dt id="id-name"><b>--id</b> <i>name</i></dt>
<dd>
<p>Use <b>name</b> as the name of the semaphore. Default is the name of the controlling tty (output from <b>tty</b>).</p>
<p>The default normally works as expected when used interactively, but when used in a script <i>name</i> should be set. <i>$$</i> or <i>my_task_name</i> are often a good value.</p>
<p>The semaphore is stored in ~/.parallel/semaphores/</p>
<p>Implies <b>--semaphore</b>.</p>
<p>See also <b>man sem</b>.</p>
</dd>
<dt id="semaphoretimeout-secs"><b>--semaphoretimeout</b> <i>secs</i></dt>
<dd>
<p>If the semaphore is not released within secs seconds, take it anyway.</p>
<p>Implies <b>--semaphore</b>.</p>
<p>See also <b>man sem</b>.</p>
</dd>
<dt id="seqreplace-replace-str"><b>--seqreplace</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of <b>{#}</b> for job sequence number.</p>
</dd>
<dt id="shebang"><b>--shebang</b></dt>
<dd>
</dd>
<dt id="hashbang"><b>--hashbang</b></dt>
<dd>
<p>GNU <b>parallel</b> can be called as a shebang (#!) command as the first line of a script. The content of the file will be treated as inputsource.</p>
<p>Like this:</p>
<pre><code> #!/usr/bin/parallel --shebang -r traceroute
foss.org.my
debian.org
freenetproject.org</code></pre>
<p><b>--shebang</b> must be set as the first option.</p>
<p>On FreeBSD <b>env</b> is needed:</p>
<pre><code> #!/usr/bin/env -S parallel --shebang -r traceroute
foss.org.my
debian.org
freenetproject.org</code></pre>
</dd>
<dt id="shebang-wrap"><b>--shebang-wrap</b></dt>
<dd>
<p>GNU <b>parallel</b> can parallelize scripts by wrapping the shebang line. If the program can be run like this:</p>
<pre><code> cat arguments | parallel the_program</code></pre>
<p>then the script can be changed to:</p>
<pre><code> #!/usr/bin/parallel --shebang-wrap /the/original/parser --with-options</code></pre>
<p>E.g.</p>
<pre><code> #!/usr/bin/parallel --shebang-wrap /usr/bin/python</code></pre>
<p>If the program can be run like this:</p>
<pre><code> cat data | parallel --pipe the_program</code></pre>
<p>then the script can be changed to:</p>
<pre><code> #!/usr/bin/parallel --shebang-wrap --pipe /the/original/parser --with-options</code></pre>
<p>E.g.</p>
<pre><code> #!/usr/bin/parallel --shebang-wrap --pipe /usr/bin/perl -w</code></pre>
<p><b>--shebang-wrap</b> must be set as the first option.</p>
</dd>
<dt id="shellquote"><b>--shellquote</b></dt>
<dd>
<p>Does not run the command but quotes it. Useful for making quoted composed commands for GNU <b>parallel</b>.</p>
</dd>
<dt id="skip-first-line"><b>--skip-first-line</b></dt>
<dd>
<p>Do not use the first line of input (used by GNU <b>parallel</b> itself when called with <b>--shebang</b>).</p>
</dd>
<dt id="sshdelay-secs"><b>--sshdelay</b> <i>secs</i></dt>
<dd>
<p>Delay starting next ssh by <i>secs</i> seconds. GNU <b>parallel</b> will pause <i>secs</i> seconds after starting each ssh. <i>secs</i> can be less than 1 seconds.</p>
</dd>
<dt id="S-ncpu-sshlogin-ncpu-sshlogin"><b>-S</b> <i>[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]</i></dt>
<dd>
</dd>
<dt id="sshlogin-ncpu-sshlogin-ncpu-sshlogin"><b>--sshlogin</b> <i>[ncpu/]sshlogin[,[ncpu/]sshlogin[,...]]</i></dt>
<dd>
<p>Distribute jobs to remote computers. The jobs will be run on a list of remote computers. GNU <b>parallel</b> will determine the number of CPU cores on the remote computers and run the number of jobs as specified by <b>-j</b>. If the number <i>ncpu</i> is given GNU <b>parallel</b> will use this number for number of CPU cores on the host. Normally <i>ncpu</i> will not be needed.</p>
<p>An <i>sshlogin</i> is of the form:</p>
<pre><code> [sshcommand [options]] [username@]hostname</code></pre>
<p>The sshlogin must not require a password.</p>
<p>The sshlogin ':' is special, it means 'no ssh' and will therefore run on the local computer.</p>
<p>The sshlogin '..' is special, it read sshlogins from ~/.parallel/sshloginfile</p>
<p>The sshlogin '-' is special, too, it read sshlogins from stdin (standard input).</p>
<p>To specify more sshlogins separate the sshlogins by comma or repeat the options multiple times.</p>
<p>For examples: see <b>--sshloginfile</b>.</p>
<p>The remote host must have GNU <b>parallel</b> installed.</p>
<p><b>--sshlogin</b> is known to cause problems with <b>-m</b> and <b>-X</b>.</p>
<p><b>--sshlogin</b> is often used with <b>--transfer</b>, <b>--return</b>, <b>--cleanup</b>, and <b>--trc</b>.</p>
</dd>
<dt id="sshloginfile-filename-beta-testing"><b>--sshloginfile</b> <i>filename</i> (beta testing)</dt>
<dd>
</dd>
<dt id="slf-filename-beta-testing"><b>--slf</b> <i>filename</i> (beta testing)</dt>
<dd>
<p>File with sshlogins. The file consists of sshlogins on separate lines. Empty lines and lines starting with '#' are ignored. Example:</p>
<pre><code> server.example.com
username@server2.example.com
8/my-8-core-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 cores
//usr/local/bin/myssh -p 2222 -l myusername hexacpu.example.net
# Use a different ssh program with 6 cores
6//usr/local/bin/myssh -p 2222 -l myusername hexacpu.example.net
# Assume 16 cores on the local computer
16/:</code></pre>
<p>When using a different ssh program the last argument must be the hostname.</p>
<p>Multiple <b>--sshloginfile</b> are allowed.</p>
<p>GNU <b>parallel</b> will first look for the file in current dir; if that fails it look for the file in ~/.parallel.</p>
<p>The sshloginfile '..' is special, it read sshlogins from ~/.parallel/sshloginfile</p>
<p>The sshloginfile '.' is special, it read sshlogins from /etc/parallel/sshloginfile</p>
<p>The sshloginfile '-' is special, too, it read sshlogins from stdin (standard input).</p>
<p>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.</p>
<p>This can be used to have a daemon that updates the sshloginfile to only contain servers that are up:</p>
<pre><code> 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 ...</code></pre>
</dd>
<dt id="slotreplace-replace-str"><b>--slotreplace</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of <b>{%}</b> for job slot number.</p>
</dd>
<dt id="silent"><b>--silent</b></dt>
<dd>
<p>Silent. The job to be run will not be printed. This is the default. Can be reversed with <b>-v</b>.</p>
</dd>
<dt id="tty"><b>--tty</b></dt>
<dd>
<p>Open terminal tty. If GNU <b>parallel</b> is used for starting an interactive program then this option may be needed. It will start only one job at a time (i.e. <b>-j1</b>), not buffer the output (i.e. <b>-u</b>), and it will open a tty for the job. When the job is done, the next job will get the tty.</p>
</dd>
<dt id="tag"><b>--tag</b></dt>
<dd>
<p>Tag lines with arguments. Each output line will be prepended with the arguments and TAB (\t). When combined with <b>--onall</b> or <b>--nonall</b> the lines will be prepended with the sshlogin instead.</p>
<p><b>--tag</b> is ignored when using <b>-u</b>.</p>
</dd>
<dt id="tagstring-str"><b>--tagstring</b> <i>str</i></dt>
<dd>
<p>Tag lines with a string. Each output line will be prepended with <i>str</i> and TAB (\t). <i>str</i> can contain replacement strings such as {}.</p>
<p><b>--tagstring</b> is ignored when using <b>-u</b>, <b>--onall</b>, and <b>--nonall</b>.</p>
</dd>
<dt id="tmpdir-dirname"><b>--tmpdir</b> <i>dirname</i></dt>
<dd>
<p>Directory for temporary files. GNU <b>parallel</b> normally buffers output into temporary files in /tmp. By setting <b>--tmpdir</b> you can use a different dir for the files. Setting <b>--tmpdir</b> is equivalent to setting $TMPDIR.</p>
</dd>
<dt id="tmux"><b>--tmux</b></dt>
<dd>
<p>Use <b>tmux</b> for output. Start a <b>tmux</b> session and run each job in a window in that session. No other output will be produced.</p>
</dd>
<dt id="timeout-val"><b>--timeout</b> <i>val</i></dt>
<dd>
<p>Time out for command. If the command runs for longer than <i>val</i> seconds it will get killed with SIGTERM, followed by SIGTERM 200 ms later, followed by SIGKILL 200 ms later.</p>
<p>If <i>val</i> is followed by a % then the timeout will dynamically be computed as a percentage of the median average runtime. Only values > 100% will make sense.</p>
</dd>
<dt id="verbose"><b>--verbose</b></dt>
<dd>
</dd>
<dt id="t"><b>-t</b></dt>
<dd>
<p>Print the job to be run on stderr (standard error).</p>
<p>See also <b>-v</b>, <b>-p</b>.</p>
</dd>
<dt id="transfer"><b>--transfer</b></dt>
<dd>
<p>Transfer files to remote computers. <b>--transfer</b> is used with <b>--sshlogin</b> when the arguments are files and should be transferred to the remote computers. The files will be transferred using <b>rsync</b> and will be put relative to the default work dir. If the path contains /./ the remaining path will be relative to the work dir. E.g.</p>
<pre><code> echo foo/bar.txt | parallel \
--sshlogin server.example.com --transfer wc</code></pre>
<p>This will transfer the file <i>foo/bar.txt</i> to the computer <i>server.example.com</i> to the file <i>$HOME/foo/bar.txt</i> before running <b>wc foo/bar.txt</b> on <i>server.example.com</i>.</p>
<pre><code> echo /tmp/foo/bar.txt | parallel \
--sshlogin server.example.com --transfer wc</code></pre>
<p>This will transfer the file <i>foo/bar.txt</i> to the computer <i>server.example.com</i> to the file <i>/tmp/foo/bar.txt</i> before running <b>wc /tmp/foo/bar.txt</b> on <i>server.example.com</i>.</p>
<p><b>--transfer</b> is often used with <b>--return</b> and <b>--cleanup</b>.</p>
<p><b>--transfer</b> is ignored when used with <b>--sshlogin :</b> or when not used with <b>--sshlogin</b>.</p>
</dd>
<dt id="trc-filename"><b>--trc</b> <i>filename</i></dt>
<dd>
<p>Transfer, Return, Cleanup. Short hand for:</p>
<p><b>--transfer</b> <b>--return</b> <i>filename</i> <b>--cleanup</b></p>
</dd>
<dt id="trim-n-l-r-lr-rl"><b>--trim</b> <n|l|r|lr|rl></dt>
<dd>
<p>Trim white space in input.</p>
<dl>
<dt id="n5">n</dt>
<dd>
<p>No trim. Input is not modified. This is the default.</p>
</dd>
<dt id="l">l</dt>
<dd>
<p>Left trim. Remove white space from start of input. E.g. " a bc " -> "a bc ".</p>
</dd>
<dt id="r1">r</dt>
<dd>
<p>Right trim. Remove white space from end of input. E.g. " a bc " -> " a bc".</p>
</dd>
<dt id="lr">lr</dt>
<dd>
</dd>
<dt id="rl">rl</dt>
<dd>
<p>Both trim. Remove white space from both start and end of input. E.g. " a bc " -> "a bc". This is the default if <b>--colsep</b> is used.</p>
</dd>
</dl>
</dd>
<dt id="ungroup"><b>--ungroup</b></dt>
<dd>
</dd>
<dt id="u"><b>-u</b></dt>
<dd>
<p>Ungroup output. Output is printed as soon as possible and by passes GNU <b>parallel</b> 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:</p>
<p><b>parallel -j0 'sleep {};echo -n start{};sleep {};echo {}end' ::: 1 2 3 4</b></p>
<p><b>parallel -u -j0 'sleep {};echo -n start{};sleep {};echo {}end' ::: 1 2 3 4</b></p>
<p>It also disables <b>--tag</b>. GNU <b>parallel</b> outputs faster with <b>-u</b>. Compare the speed of these:</p>
<pre><code> parallel seq ::: 300000000 >/dev/null
parallel -u seq ::: 300000000 >/dev/null
parallel --line-buffer seq ::: 300000000 >/dev/null</code></pre>
<p>Can be reversed with <b>--group</b>.</p>
<p>See also: <b>--line-buffer</b> <b>--group</b></p>
</dd>
<dt id="extensionreplace-replace-str"><b>--extensionreplace</b> <i>replace-str</i></dt>
<dd>
</dd>
<dt id="er-replace-str"><b>--er</b> <i>replace-str</i></dt>
<dd>
<p>Use the replacement string <i>replace-str</i> instead of {.} for input line without extension.</p>
</dd>
<dt id="use-cpus-instead-of-cores"><b>--use-cpus-instead-of-cores</b></dt>
<dd>
<p>Count the number of physical CPUs instead of CPU cores. When computing how many jobs to run simultaneously relative to the number of CPU cores you can ask GNU <b>parallel</b> to instead look at the number of physical CPUs. This will make sense for computers that have hyperthreading as two jobs running on one CPU with hyperthreading will run slower than two jobs running on two physical CPUs. Some multi-core CPUs can run faster if only one thread is running per physical CPU. Most users will not need this option.</p>
</dd>
<dt id="v"><b>-v</b></dt>
<dd>
<p>Verbose. Print the job to be run on stdout (standard output). Can be reversed with <b>--silent</b>. See also <b>-t</b>.</p>
<p>Use <b>-v</b> <b>-v</b> to print the wrapping ssh command when running remotely.</p>
</dd>
<dt id="version"><b>--version</b></dt>
<dd>
</dd>
<dt id="V"><b>-V</b></dt>
<dd>
<p>Print the version GNU <b>parallel</b> and exit.</p>
</dd>
<dt id="workdir-mydir"><b>--workdir</b> <i>mydir</i></dt>
<dd>
</dd>
<dt id="wd-mydir"><b>--wd</b> <i>mydir</i></dt>
<dd>
<p>Files transferred using <b>--transfer</b> and <b>--return</b> will be relative to <i>mydir</i> on remote computers, and the command will be executed in the dir <i>mydir</i>.</p>
<p>The special <i>mydir</i> value <b>...</b> will create working dirs under <b>~/.parallel/tmp/</b> on the remote computers. If <b>--cleanup</b> is given these dirs will be removed.</p>
<p>The special <i>mydir</i> value <b>.</b> uses the current working dir. If the current working dir is beneath your home dir, the value <b>.</b> 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.</p>
<p>To see the difference try:</p>
<p><b>parallel -S server pwd ::: ""</b></p>
<p><b>parallel --wd . -S server pwd ::: ""</b></p>
<p><b>parallel --wd ... -S server pwd ::: ""</b></p>
</dd>
<dt id="wait"><b>--wait</b></dt>
<dd>
<p>Wait for all commands to complete.</p>
<p>Implies <b>--semaphore</b>.</p>
<p>See also <b>man sem</b>.</p>
</dd>
<dt id="X"><b>-X</b></dt>
<dd>
<p>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 <b>-j1</b> to avoid this.</p>
<p>If <b>{}</b> is not used the arguments will be appended to the line. If <b>{}</b> is used as part of a word (like <i>pic{}.jpg</i>) then the whole word will be repeated. If <b>{}</b> is used multiple times each <b>{}</b> will be replaced with the arguments.</p>
<p>Normally <b>-X</b> will do the right thing, whereas <b>-m</b> can give unexpected results if <b>{}</b> is used as part of a word.</p>
<p>Support for <b>-X</b> with <b>--sshlogin</b> is limited and may fail.</p>
<p>See also <b>-m</b>.</p>
</dd>
<dt id="exit"><b>--exit</b></dt>
<dd>
</dd>
<dt id="x"><b>-x</b></dt>
<dd>
<p>Exit if the size (see the <b>-s</b> option) is exceeded.</p>
</dd>
<dt id="xapply"><b>--xapply</b></dt>
<dd>
<p>Read multiple input sources like <b>xapply</b>. 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 <b>{1}</b> .. <b>{</b><i>n</i><b>}</b>, so <b>{1}</b> will be a line from the first input source, and <b>{6}</b> will refer to the line with the same line number from the 6th input source.</p>
<p>Compare these two:</p>
<pre><code> parallel echo {1} {2} ::: 1 2 3 ::: a b c
parallel --xapply echo {1} {2} ::: 1 2 3 ::: a b c</code></pre>
<p>Arguments will be recycled if one input source has more arguments than the others:</p>
<pre><code> parallel --xapply echo {1} {2} {3} ::: 1 2 ::: I II III ::: a b c d e f g</code></pre>
<p>See also <b>--header</b>.</p>
</dd>
</dl>
<h1 id="EXAMPLE:-Working-as-xargs--n1.-Argument-appending">EXAMPLE: Working as xargs -n1. Argument appending</h1>
<p>GNU <b>parallel</b> can work similar to <b>xargs -n1</b>.</p>
<p>To compress all html files using <b>gzip</b> run:</p>
<p><b>find . -name '*.html' | parallel gzip --best</b></p>
<p>If the file names may contain a newline use <b>-0</b>. Substitute FOO BAR with FUBAR in all files in this dir and subdirs:</p>
<p><b>find . -type f -print0 | parallel -q0 perl -i -pe 's/FOO BAR/FUBAR/g'</b></p>
<p>Note <b>-q</b> is needed because of the space in 'FOO BAR'.</p>
<h1 id="EXAMPLE:-Reading-arguments-from-command-line">EXAMPLE: Reading arguments from command line</h1>
<p>GNU <b>parallel</b> can take the arguments from command line instead of stdin (standard input). To compress all html files in the current dir using <b>gzip</b> run:</p>
<p><b>parallel gzip --best ::: *.html</b></p>
<p>To convert *.wav to *.mp3 using LAME running one process per CPU core run:</p>
<p><b>parallel lame {} -o {.}.mp3 ::: *.wav</b></p>
<h1 id="EXAMPLE:-Inserting-multiple-arguments">EXAMPLE: Inserting multiple arguments</h1>
<p>When moving a lot of files like this: <b>mv *.log destdir</b> you will sometimes get the error:</p>
<p><b>bash: /bin/mv: Argument list too long</b></p>
<p>because there are too many files. You can instead do:</p>
<p><b>ls | grep -E '\.log$' | parallel mv {} destdir</b></p>
<p>This will run <b>mv</b> for each file. It can be done faster if <b>mv</b> gets as many arguments that will fit on the line:</p>
<p><b>ls | grep -E '\.log$' | parallel -m mv {} destdir</b></p>
<h1 id="EXAMPLE:-Context-replace">EXAMPLE: Context replace</h1>
<p>To remove the files <i>pict0000.jpg</i> .. <i>pict9999.jpg</i> you could do:</p>
<p><b>seq -w 0 9999 | parallel rm pict{}.jpg</b></p>
<p>You could also do:</p>
<p><b>seq -w 0 9999 | perl -pe 's/(.*)/pict$1.jpg/' | parallel -m rm</b></p>
<p>The first will run <b>rm</b> 10000 times, while the last will only run <b>rm</b> as many times needed to keep the command line length short enough to avoid <b>Argument list too long</b> (it typically runs 1-2 times).</p>
<p>You could also run:</p>
<p><b>seq -w 0 9999 | parallel -X rm pict{}.jpg</b></p>
<p>This will also only run <b>rm</b> as many times needed to keep the command line length short enough.</p>
<h1 id="EXAMPLE:-Compute-intensive-jobs-and-substitution">EXAMPLE: Compute intensive jobs and substitution</h1>
<p>If ImageMagick is installed this will generate a thumbnail of a jpg file:</p>
<p><b>convert -geometry 120 foo.jpg thumb_foo.jpg</b></p>
<p>This will run with number-of-cpu-cores jobs in parallel for all jpg files in a directory:</p>
<p><b>ls *.jpg | parallel convert -geometry 120 {} thumb_{}</b></p>
<p>To do it recursively use <b>find</b>:</p>
<p><b>find . -name '*.jpg' | parallel convert -geometry 120 {} {}_thumb.jpg</b></p>
<p>Notice how the argument has to start with <b>{}</b> as <b>{}</b> will include path (e.g. running <b>convert -geometry 120 ./foo/bar.jpg thumb_./foo/bar.jpg</b> would clearly be wrong). The command will generate files like ./foo/bar.jpg_thumb.jpg.</p>
<p>Use <b>{.}</b> to avoid the extra .jpg in the file name. This command will make files like ./foo/bar_thumb.jpg:</p>
<p><b>find . -name '*.jpg' | parallel convert -geometry 120 {} {.}_thumb.jpg</b></p>
<h1 id="EXAMPLE:-Substitution-and-redirection">EXAMPLE: Substitution and redirection</h1>
<p>This will generate an uncompressed version of .gz-files next to the .gz-file:</p>
<p><b>parallel zcat {} "</b>><b>"{.} ::: *.gz</b></p>
<p>Quoting of > is necessary to postpone the redirection. Another solution is to quote the whole command:</p>
<p><b>parallel "zcat {} </b>><b>{.}" ::: *.gz</b></p>
<p>Other special shell characters (such as * ; $ > < | >> <<) also need to be put in quotes, as they may otherwise be interpreted by the shell and not given to GNU <b>parallel</b>.</p>
<h1 id="EXAMPLE:-Composed-commands">EXAMPLE: Composed commands</h1>
<p>A job can consist of several commands. This will print the number of files in each directory:</p>
<p><b>ls | parallel 'echo -n {}" "; ls {}|wc -l'</b></p>
<p>To put the output in a file called <name>.dir:</p>
<p><b>ls | parallel '(echo -n {}" "; ls {}|wc -l) </b>> <b>{}.dir'</b></p>
<p>Even small shell scripts can be run by GNU <b>parallel</b>:</p>
<p><b>find . | parallel 'a={}; name=${a##*/}; upper=$(echo "$name" | tr "[:lower:]" "[:upper:]"); echo "$name - $upper"'</b></p>
<p><b>ls | parallel 'mv {} "$(echo {} | tr "[:upper:]" "[:lower:]")"'</b></p>
<p>Given a list of URLs, list all URLs that fail to download. Print the line number and the URL.</p>
<p><b>cat urlfile | parallel "wget {} 2</b>><b>/dev/null || grep -n {} urlfile"</b></p>
<p>Create a mirror directory with the same filenames except all files and symlinks are empty files.</p>
<p><b>cp -rs /the/source/dir mirror_dir; find mirror_dir -type l | parallel -m rm {} '&&' touch {}</b></p>
<p>Find the files in a list that do not exist</p>
<p><b>cat file_list | parallel 'if [ ! -e {} ] ; then echo {}; fi'</b></p>
<h1 id="EXAMPLE:-Calling-Bash-functions">EXAMPLE: Calling Bash functions</h1>
<p>If the composed command is longer than a line, it becomes hard to read. In Bash you can use functions. Just remember to <b>export -f</b> the function.</p>
<pre><code> doit() {
echo Doing it for $1
sleep 2
echo Done with $1
}
export -f doit
parallel doit ::: 1 2 3
doubleit() {
echo Doing it for $1 $2
sleep 2
echo Done with $1 $2
}
export -f doubleit
parallel doubleit ::: 1 2 3 ::: a b</code></pre>
<p>To do this on remote servers you need to transfer the function using <b>--env</b>:</p>
<pre><code> parallel --env doit -S server doit ::: 1 2 3
parallel --env doubleit -S server doubleit ::: 1 2 3 ::: a b</code></pre>
<p>If your environment (aliases, variables, and functions) is small you can copy the full environment without having to <b>export -f</b> anything. Just run this first:</p>
<pre><code> env_parallel() {
export parallel_bash_environment='() {
'"$(echo "shopt -s expand_aliases 2>/dev/null"; alias;typeset -p | grep -vFf <(readonly; echo GROUPS; echo FUNCNAME; echo DIRSTACK; echo _; echo PIPESTATUS; echo USERNAME) | grep -v BASH_;typeset -f)"'
}'
# Run as: env_parallel parallel_bash_environment "2>/dev/null;" ...
`which parallel` "$@"
unset parallel_bash_environment
}</code></pre>
<p>And then call as:</p>
<pre><code> env_parallel doit ::: 1 2 3
env_parallel doubleit ::: 1 2 3 ::: a b
env_parallel -S server doit ::: 1 2 3
env_parallel -S server doubleit ::: 1 2 3 ::: a b</code></pre>
<h1 id="EXAMPLE:-Function-tester">EXAMPLE: Function tester</h1>
<p>To test a program with different parameters:</p>
<pre><code> tester() {
if (eval "$@") >&/dev/null; then
perl -e 'printf "\033[30;102m[ OK ]\033[0m @ARGV\n"' "$@"
else
perl -e 'printf "\033[30;101m[FAIL]\033[0m @ARGV\n"' "$@"
fi
}
export -f tester
parallel tester my_program ::: arg1 arg2
parallel tester exit ::: 1 0 2 0</code></pre>
<p>If <b>my_program</b> fails a red FAIL will be printed followed by the failing command; otherwise a green OK will be printed followed by the command.</p>
<h1 id="EXAMPLE:-Removing-file-extension-when-processing-files">EXAMPLE: Removing file extension when processing files</h1>
<p>When processing files removing the file extension using <b>{.}</b> is often useful.</p>
<p>Create a directory for each zip-file and unzip it in that dir:</p>
<p><b>parallel 'mkdir {.}; cd {.}; unzip ../{}' ::: *.zip</b></p>
<p>Recompress all .gz files in current directory using <b>bzip2</b> running 1 job per CPU core in parallel:</p>
<p><b>parallel "zcat {} | bzip2 </b>><b>{.}.bz2 && rm {}" ::: *.gz</b></p>
<p>Convert all WAV files to MP3 using LAME:</p>
<p><b>find sounddir -type f -name '*.wav' | parallel lame {} -o {.}.mp3</b></p>
<p>Put all converted in the same directory:</p>
<p><b>find sounddir -type f -name '*.wav' | parallel lame {} -o mydir/{/.}.mp3</b></p>
<h1 id="EXAMPLE:-Removing-two-file-extensions-when-processing-files">EXAMPLE: Removing two file extensions when processing files</h1>
<p>If you have directory with tar.gz files and want these extracted in the corresponding dir (e.g foo.tar.gz will be extracted in the dir foo) you can do:</p>
<p><b>parallel --plus 'mkdir {..}; tar -C {..} -xf {}' ::: *.tar.gz</b></p>
<h1 id="EXAMPLE:-Download-10-images-for-each-of-the-past-30-days">EXAMPLE: Download 10 images for each of the past 30 days</h1>
<p>Let us assume a website stores images like:</p>
<pre><code> http://www.example.com/path/to/YYYYMMDD_##.jpg</code></pre>
<p>where YYYYMMDD is the date and ## is the number 01-10. This will download images for the past 30 days:</p>
<p><b>parallel wget http://www.example.com/path/to/'$(date -d "today -{1} days" +%Y%m%d)_{2}.jpg' ::: $(seq 30) ::: $(seq -w 10)</b></p>
<p><b>$(date -d "today -{1} days" +%Y%m%d)</b> will give the dates in YYYYMMDD with {1} days subtracted.</p>
<h1 id="EXAMPLE:-Copy-files-as-last-modified-date-ISO8601-with-added-random-digits">EXAMPLE: Copy files as last modified date (ISO8601) with added random digits</h1>
<p><b>find . | parallel 'cp {} ../destdir/{= $a = int(10000*rand); $_ = `date -r "$_" +%FT%T"$a"`; chomp; =}'</b></p>
<h1 id="EXAMPLE:-Digtal-clock-with-blinking">EXAMPLE: Digtal clock with "blinking" :</h1>
<p>The : in a digital clock blinks. To make every other line have a ':' and the rest a ' ' a perl expression is used to look at the 3rd input source. If the value modudo 2 is 1: Use ":" otherwise use " ":</p>
<p><b>parallel -k echo {1}'{=3 $_=$_%2?":":" "=}'{2}{3} ::: {0..12} ::: {0..5} ::: {0..9}</b></p>
<h1 id="EXAMPLE:-Aggregating-content-of-files">EXAMPLE: Aggregating content of files</h1>
<p>This:</p>
<pre><code> parallel --header : echo x{X}y{Y}z{Z} \> x{X}y{Y}z{Z} \
::: X {1..5} ::: Y {01..10} ::: Z {1..5}</code></pre>
<p>will generate the files x1y01z1 .. x5y10z5. If you want to aggregate the output grouping on x and z you can do this:</p>
<pre><code> parallel eval 'cat {=s/y01/y*/=} > {=s/y01//=}' ::: *y01*</code></pre>
<p>For all values of x and z it runs commands like:</p>
<pre><code> cat x1y*z1 > x1z1</code></pre>
<p>So you end up with x1z1 .. x1z5 each containing the content of all values of y.</p>
<h1 id="EXAMPLE:-Breadth-first-parallel-web-crawler-mirrorer">EXAMPLE: Breadth first parallel web crawler/mirrorer</h1>
<p>This script below will crawl and mirror a URL in parallel. It downloads first pages that are 1 click down, then 2 clicks down, then 3; instead of the normal depth first, where the first link link on each page is fetched first.</p>
<p>Run like this:</p>
<p><b>PARALLEL=-j100 ./parallel-crawl http://gatt.org.yeslab.org/</b></p>
<p>Remove the <b>wget</b> part if you only want a web crawler.</p>
<p>It works by fetching a page from a list of URLs and looking for links in that page that are within the same starting URL and that have not already been seen. These links are added to a new queue. When all the pages from the list is done, the new queue is moved to the list of URLs and the process is started over until no unseen links are found.</p>
<pre><code> #!/bin/bash
# E.g. http://gatt.org.yeslab.org/
URL=$1
# Stay inside the start dir
BASEURL=$(echo $URL | perl -pe 's:#.*::; s:(//.*/)[^/]*:$1:')
URLLIST=$(mktemp urllist.XXXX)
URLLIST2=$(mktemp urllist.XXXX)
SEEN=$(mktemp seen.XXXX)
# Spider to get the URLs
echo $URL >$URLLIST
cp $URLLIST $SEEN
while [ -s $URLLIST ] ; do
cat $URLLIST |
parallel lynx -listonly -image_links -dump {} \; wget -qm -l1 -Q1 {} \; echo Spidered: {} \>\&2 |
perl -ne 's/#.*//; s/\s+\d+.\s(\S+)$/$1/ and do { $seen{$1}++ or print }' |
grep -F $BASEURL |
grep -v -x -F -f $SEEN | tee -a $SEEN > $URLLIST2
mv $URLLIST2 $URLLIST
done
rm -f $URLLIST $URLLIST2 $SEEN</code></pre>
<h1 id="EXAMPLE:-Process-files-from-a-tar-file-while-unpacking">EXAMPLE: Process files from a tar file while unpacking</h1>
<p>If the files to be processed are in a tar file then unpacking one file and processing it immediately may be faster than first unpacking all files.</p>
<p><b>tar xvf foo.tgz | perl -ne 'print $l;$l=$_;END{print $l}' | parallel echo</b></p>
<p>The Perl one-liner is needed to avoid race condition.</p>
<h1 id="EXAMPLE:-Rewriting-a-for-loop-and-a-while-read-loop">EXAMPLE: Rewriting a for-loop and a while-read-loop</h1>
<p>for-loops like this:</p>
<pre><code> (for x in `cat list` ; do
do_something $x
done) | process_output</code></pre>
<p>and while-read-loops like this:</p>
<pre><code> cat list | (while read x ; do
do_something $x
done) | process_output</code></pre>
<p>can be written like this:</p>
<p><b>cat list | parallel do_something | process_output</b></p>
<p>For example: Find which host name in a list has IP address 1.2.3 4:</p>
<p><b>cat hosts.txt | parallel -P 100 host | grep 1.2.3.4</b></p>
<p>If the processing requires more steps the for-loop like this:</p>
<pre><code> (for x in `cat list` ; do
no_extension=${x%.*};
do_something $x scale $no_extension.jpg
do_step2 <$x $no_extension
done) | process_output</code></pre>
<p>and while-loops like this:</p>
<pre><code> cat list | (while read x ; do
no_extension=${x%.*};
do_something $x scale $no_extension.jpg
do_step2 <$x $no_extension
done) | process_output</code></pre>
<p>can be written like this:</p>
<p><b>cat list | parallel "do_something {} scale {.}.jpg ; do_step2 <{} {.}" | process_output</b></p>
<h1 id="EXAMPLE:-Rewriting-nested-for-loops">EXAMPLE: Rewriting nested for-loops</h1>
<p>Nested for-loops like this:</p>
<pre><code> (for x in `cat xlist` ; do
for y in `cat ylist` ; do
do_something $x $y
done
done) | process_output</code></pre>
<p>can be written like this:</p>
<p><b>parallel do_something {1} {2} :::: xlist ylist | process_output</b></p>
<p>Nested for-loops like this:</p>
<pre><code> (for gender in M F ; do
for size in S M L XL XXL ; do
echo $gender $size
done
done) | sort</code></pre>
<p>can be written like this:</p>
<p><b>parallel echo {1} {2} ::: M F ::: S M L XL XXL | sort</b></p>
<h1 id="EXAMPLE:-Finding-the-lowest-difference-between-files">EXAMPLE: Finding the lowest difference between files</h1>
<p><b>diff</b> is good for finding differences in text files. <b>diff | wc -l</b> gives an indication of the size of the difference. To find the differences between all files in the current dir do:</p>
<p><b>parallel --tag 'diff {1} {2} | wc -l' ::: * ::: * | sort -nk3</b></p>
<p>This way it is possible to see if some files are closer to other files.</p>
<h1 id="EXAMPLE:-for-loops-with-column-names">EXAMPLE: for-loops with column names</h1>
<p>When doing multiple nested for-loops it can be easier to keep track of the loop variable if is is named instead of just having a number. Use <b>--header :</b> to let the first argument be an named alias for the positional replacement string:</p>
<pre><code> parallel --header : echo {gender} {size} ::: gender M F ::: size S M L XL XXL</code></pre>
<p>This also works if the input file is a file with columns:</p>
<pre><code> cat addressbook.tsv | parallel --colsep '\t' --header : echo {Name} {E-mail address}</code></pre>
<h1 id="EXAMPLE:-Count-the-differences-between-all-files-in-a-dir">EXAMPLE: Count the differences between all files in a dir</h1>
<p>Using <b>--results</b> the results are saved in /tmp/diffcount*.</p>
<pre><code> parallel --results /tmp/diffcount "diff -U 0 {1} {2} |tail -n +3 |grep -v '^@'|wc -l" ::: * ::: *</code></pre>
<p>To see the difference between file A and file B look at the file '/tmp/diffcount/1/A/2/B'.</p>
<h1 id="EXAMPLE:-Speeding-up-fast-jobs">EXAMPLE: Speeding up fast jobs</h1>
<p>Starting a job on the local machine takes around 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 <b>-X</b> which will make the overhead less significant. Compare the speed of these:</p>
<pre><code> seq -w 0 9999 | parallel touch pict{}.jpg
seq -w 0 9999 | parallel -X touch pict{}.jpg</code></pre>
<p>If your program cannot take multiple arguments, then you can use GNU <b>parallel</b> to spawn multiple GNU <b>parallel</b>s:</p>
<pre><code> seq -w 0 999999 | parallel -j10 --pipe parallel -j0 touch pict{}.jpg</code></pre>
<p>If <b>-j0</b> normally spawns 252 jobs, then the above will try to spawn 2520 jobs. On a normal GNU/Linux system you can spawn 32000 jobs using this technique with no problems. To raise the 32000 jobs limit raise /proc/sys/kernel/pid_max to 4194303.</p>
<h1 id="EXAMPLE:-Using-shell-variables">EXAMPLE: Using shell variables</h1>
<p>When using shell variables you need to quote them correctly as they may otherwise be split on spaces.</p>
<p>Notice the difference between:</p>
<pre><code> V=("My brother's 12\" records are worth <\$\$\$>"'!' Foo Bar)
parallel echo ::: ${V[@]} # This is probably not what you want</code></pre>
<p>and:</p>
<pre><code> V=("My brother's 12\" records are worth <\$\$\$>"'!' Foo Bar)
parallel echo ::: "${V[@]}"</code></pre>
<p>When using variables in the actual command that contains special characters (e.g. space) you can quote them using <b>'"$VAR"'</b> or using "'s and <b>-q</b>:</p>
<pre><code> V="Here are two "
parallel echo "'$V'" ::: spaces
parallel -q echo "$V" ::: spaces</code></pre>
<h1 id="EXAMPLE:-Group-output-lines">EXAMPLE: Group output lines</h1>
<p>When running jobs that output data, you often do not want the output of multiple jobs to run together. GNU <b>parallel</b> defaults to grouping the output of each job, so the output is printed when the job finishes. If you want full lines to be printed while the job is running you can use <b>--line-buffer</b>. If you want output to be printed as soon as possible you can use <b>-u</b>.</p>
<p>Compare the output of:</p>
<p><b>parallel traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<p>to the output of:</p>
<p><b>parallel --line-buffer traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<p>and:</p>
<p><b>parallel -u traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<h1 id="EXAMPLE:-Tag-output-lines">EXAMPLE: Tag output lines</h1>
<p>GNU <b>parallel</b> groups the output lines, but it can be hard to see where the different jobs begin. <b>--tag</b> prepends the argument to make that more visible:</p>
<p><b>parallel --tag traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<p><b>--tag</b> works with <b>--line-buffer</b> but not with <b>-u</b>:</p>
<p><b>parallel --tag --line-buffer traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<p>Check the uptime of the servers in <i>~/.parallel/sshloginfile</i>:</p>
<p><b>parallel --tag -S .. --nonall uptime</b></p>
<h1 id="EXAMPLE:-Keep-order-of-output-same-as-order-of-input">EXAMPLE: Keep order of output same as order of input</h1>
<p>Normally the output of a job will be printed as soon as it completes. Sometimes you want the order of the output to remain the same as the order of the input. This is often important, if the output is used as input for another system. <b>-k</b> will make sure the order of output will be in the same order as input even if later jobs end before earlier jobs.</p>
<p>Append a string to every line in a text file:</p>
<p><b>cat textfile | parallel -k echo {} append_string</b></p>
<p>If you remove <b>-k</b> some of the lines may come out in the wrong order.</p>
<p>Another example is <b>traceroute</b>:</p>
<p><b>parallel traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<p>will give traceroute of foss.org.my, debian.org and freenetproject.org, but it will be sorted according to which job completed first.</p>
<p>To keep the order the same as input run:</p>
<p><b>parallel -k traceroute ::: foss.org.my debian.org freenetproject.org</b></p>
<p>This will make sure the traceroute to foss.org.my will be printed first.</p>
<p>A bit more complex example is downloading a huge file in chunks in parallel: Some internet connections will deliver more data if you download files in parallel. For downloading files in parallel see: "EXAMPLE: Download 10 images for each of the past 30 days". But if you are downloading a big file you can download the file in chunks in parallel.</p>
<p>To download byte 10000000-19999999 you can use <b>curl</b>:</p>
<p><b>curl -r 10000000-19999999 http://example.com/the/big/file</b> > <b>file.part</b></p>
<p>To download a 1 GB file we need 100 10MB chunks downloaded and combined in the correct order.</p>
<p><b>seq 0 99 | parallel -k curl -r \ {}0000000-{}9999999 http://example.com/the/big/file</b> > <b>file</b></p>
<h1 id="EXAMPLE:-Parallel-grep">EXAMPLE: Parallel grep</h1>
<p><b>grep -r</b> greps recursively through directories. On multicore CPUs GNU <b>parallel</b> can often speed this up.</p>
<p><b>find . -type f | parallel -k -j150% -n 1000 -m grep -H -n STRING {}</b></p>
<p>This will run 1.5 job per core, and give 1000 arguments to <b>grep</b>.</p>
<h1 id="EXAMPLE:-Grepping-n-lines-for-m-regular-expressions">EXAMPLE: Grepping n lines for m regular expressions.</h1>
<p>The simplest solution to grep a big file for a lot of regexps is:</p>
<pre><code> grep -f regexps.txt bigfile</code></pre>
<p>Or if the regexps are fixed strings:</p>
<pre><code> grep -F -f regexps.txt bigfile</code></pre>
<p>There are 2 limiting factors: CPU and disk I/O. CPU is easy to measure: If the grep takes >90% CPU (e.g. when running top), then the CPU is a limiting factor, and parallelization will speed this up. If not, then disk I/O is the limiting factor, and depending on the disk system it may be faster or slower to parallelize. The only way to know for certain is to measure.</p>
<p>If the CPU is the limiting factor parallelization should be done on the regexps:</p>
<pre><code> cat regexp.txt | parallel --pipe -L1000 --round-robin grep -f - bigfile</code></pre>
<p>If a line matches multiple regexps, the line may be duplicated. The command will start one grep per CPU and read bigfile one time per CPU, but as that is done in parallel, all reads except the first will be cached in RAM. Depending on the size of regexp.txt it may be faster to use --block 10m instead of -L1000. If regexp.txt is too big to fit in RAM, remove --round-robin and adjust -L1000. This will cause bigfile to be read more times.</p>
<p>Some storage systems perform better when reading multiple chunks in parallel. This is true for some RAID systems and for some network file systems. To parallelize the reading of bigfile:</p>
<pre><code> parallel --pipepart --block 100M -a bigfile -k grep -f regexp.txt</code></pre>
<p>This will split bigfile into 100MB chunks and run grep on each of these chunks. To parallelize both reading of bigfile and regexp.txt combine the two using --fifo:</p>
<pre><code> parallel --pipepart --block 100M -a bigfile --fifo cat regexp.txt \
\| parallel --pipe -L1000 --round-robin grep -f - {}</code></pre>
<p>If a line matches multiple regexps, the line may be duplicated.</p>
<h1 id="EXAMPLE:-Using-remote-computers">EXAMPLE: Using remote computers</h1>
<p>To run commands on a remote computer SSH needs to be set up and you must be able to login without entering a password (The commands <b>ssh-copy-id</b> and <b>ssh-agent</b> may help you do that).</p>
<p>If you need to login to a whole cluster, you typically do not want to accept the host key for every host. You want to accept them the first time and be warned if they are ever changed. To do that:</p>
<pre><code> # Add the servers to the sshloginfile
(echo servera; echo serverb) > .parallel/my_cluster
# Make sure .ssh/config exist
touch .ssh/config
cp .ssh/config .ssh/config.backup
# Disable StrictHostKeyChecking temporarily
(echo 'Host *'; echo StrictHostKeyChecking no) >> .ssh/config
parallel --slf my_cluster --nonall true
# Remove the disabling of StrictHostKeyChecking
mv .ssh/config.backup .ssh/config</code></pre>
<p>The servers in <b>.parallel/my_cluster</b> are now added in <b>.ssh/known_hosts</b>.</p>
<p>To run <b>echo</b> on <b>server.example.com</b>:</p>
<pre><code> seq 10 | parallel --sshlogin server.example.com echo</code></pre>
<p>To run commands on more than one remote computer run:</p>
<pre><code> seq 10 | parallel --sshlogin server.example.com,server2.example.net echo</code></pre>
<p>Or:</p>
<pre><code> seq 10 | parallel --sshlogin server.example.com \
--sshlogin server2.example.net echo</code></pre>
<p>If the login username is <i>foo</i> on <i>server2.example.net</i> use:</p>
<pre><code> seq 10 | parallel --sshlogin server.example.com \
--sshlogin foo@server2.example.net echo</code></pre>
<p>If your list of hosts is <i>server1-88.example.net</i> with login <i>foo</i>:</p>
<pre><code> seq 10 | parallel -Sfoo@server{1..88}.example.net echo</code></pre>
<p>To distribute the commands to a list of computers, make a file <i>mycomputers</i> with all the computers:</p>
<pre><code> server.example.com
foo@server2.example.com
server3.example.com</code></pre>
<p>Then run:</p>
<pre><code> seq 10 | parallel --sshloginfile mycomputers echo</code></pre>
<p>To include the local computer add the special sshlogin ':' to the list:</p>
<pre><code> server.example.com
foo@server2.example.com
server3.example.com
:</code></pre>
<p>GNU <b>parallel</b> will try to determine the number of CPU cores on each of the remote computers, and run one job per CPU core - even if the remote computers do not have the same number of CPU cores.</p>
<p>If the number of CPU cores on the remote computers is not identified correctly the number of CPU cores can be added in front. Here the computer has 8 CPU cores.</p>
<pre><code> seq 10 | parallel --sshlogin 8/server.example.com echo</code></pre>
<h1 id="EXAMPLE:-Transferring-of-files">EXAMPLE: Transferring of files</h1>
<p>To recompress gzipped files with <b>bzip2</b> using a remote computer run:</p>
<pre><code> find logs/ -name '*.gz' | \
parallel --sshlogin server.example.com \
--transfer "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>This will list the .gz-files in the <i>logs</i> directory and all directories below. Then it will transfer the files to <i>server.example.com</i> to the corresponding directory in <i>$HOME/logs</i>. On <i>server.example.com</i> the file will be recompressed using <b>zcat</b> and <b>bzip2</b> resulting in the corresponding file with <i>.gz</i> replaced with <i>.bz2</i>.</p>
<p>If you want the resulting bz2-file to be transferred back to the local computer add <i>--return {.}.bz2</i>:</p>
<pre><code> find logs/ -name '*.gz' | \
parallel --sshlogin server.example.com \
--transfer --return {.}.bz2 "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>After the recompressing is done the <i>.bz2</i>-file is transferred back to the local computer and put next to the original <i>.gz</i>-file.</p>
<p>If you want to delete the transferred files on the remote computer add <i>--cleanup</i>. This will remove both the file transferred to the remote computer and the files transferred from the remote computer:</p>
<pre><code> find logs/ -name '*.gz' | \
parallel --sshlogin server.example.com \
--transfer --return {.}.bz2 --cleanup "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>If you want run on several computers add the computers to <i>--sshlogin</i> either using ',' or multiple <i>--sshlogin</i>:</p>
<pre><code> find logs/ -name '*.gz' | \
parallel --sshlogin server.example.com,server2.example.com \
--sshlogin server3.example.com \
--transfer --return {.}.bz2 --cleanup "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>You can add the local computer using <i>--sshlogin :</i>. This will disable the removing and transferring for the local computer only:</p>
<pre><code> find logs/ -name '*.gz' | \
parallel --sshlogin server.example.com,server2.example.com \
--sshlogin server3.example.com \
--sshlogin : \
--transfer --return {.}.bz2 --cleanup "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>Often <i>--transfer</i>, <i>--return</i> and <i>--cleanup</i> are used together. They can be shortened to <i>--trc</i>:</p>
<pre><code> find logs/ -name '*.gz' | \
parallel --sshlogin server.example.com,server2.example.com \
--sshlogin server3.example.com \
--sshlogin : \
--trc {.}.bz2 "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>With the file <i>mycomputers</i> containing the list of computers it becomes:</p>
<pre><code> find logs/ -name '*.gz' | parallel --sshloginfile mycomputers \
--trc {.}.bz2 "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<p>If the file <i>~/.parallel/sshloginfile</i> contains the list of computers the special short hand <i>-S ..</i> can be used:</p>
<pre><code> find logs/ -name '*.gz' | parallel -S .. \
--trc {.}.bz2 "zcat {} | bzip2 -9 >{.}.bz2"</code></pre>
<h1 id="EXAMPLE:-Distributing-work-to-local-and-remote-computers">EXAMPLE: Distributing work to local and remote computers</h1>
<p>Convert *.mp3 to *.ogg running one process per CPU core on local computer and server2:</p>
<pre><code> parallel --trc {.}.ogg -S server2,: \
'mpg321 -w - {} | oggenc -q0 - -o {.}.ogg' ::: *.mp3</code></pre>
<h1 id="EXAMPLE:-Running-the-same-command-on-remote-computers">EXAMPLE: Running the same command on remote computers</h1>
<p>To run the command <b>uptime</b> on remote computers you can do:</p>
<p><b>parallel --tag --nonall -S server1,server2 uptime</b></p>
<p><b>--nonall</b> reads no arguments. If you have a list of jobs you want run on each computer you can do:</p>
<p><b>parallel --tag --onall -S server1,server2 echo ::: 1 2 3</b></p>
<p>Remove <b>--tag</b> if you do not want the sshlogin added before the output.</p>
<p>If you have a lot of hosts use '-j0' to access more hosts in parallel.</p>
<h1 id="EXAMPLE:-Parallelizing-rsync">EXAMPLE: Parallelizing rsync</h1>
<p><b>rsync</b> is a great tool, but sometimes it will not fill up the available bandwidth. This is often a problem when copying several big files over high speed connections.</p>
<p>The following will start one <b>rsync</b> per big file in <i>src-dir</i> to <i>dest-dir</i> on the server <i>fooserver</i>:</p>
<p><b>cd src-dir; find . -type f -size +100000 | parallel -v ssh fooserver mkdir -p /dest-dir/{//}\;rsync -s -Havessh {} fooserver:/dest-dir/{}</b></p>
<p>The dirs created may end up with wrong permissions and smaller files are not being transferred. To fix those run <b>rsync</b> a final time:</p>
<p><b>rsync -Havessh src-dir/ fooserver:/dest-dir/</b></p>
<p>If you are unable to push data, but need to pull them and the files are called digits.png (e.g. 000000.png) you might be able to do:</p>
<p><b>seq -w 0 99 | parallel rsync -Havessh fooserver:src-path/*{}.png destdir/</b></p>
<h1 id="EXAMPLE:-Use-multiple-inputs-in-one-command">EXAMPLE: Use multiple inputs in one command</h1>
<p>Copy files like foo.es.ext to foo.ext:</p>
<p><b>ls *.es.* | perl -pe 'print; s/\.es//' | parallel -N2 cp {1} {2}</b></p>
<p>The perl command spits out 2 lines for each input. GNU <b>parallel</b> takes 2 inputs (using <b>-N2</b>) and replaces {1} and {2} with the inputs.</p>
<p>Count in binary:</p>
<p><b>parallel -k echo ::: 0 1 ::: 0 1 ::: 0 1 ::: 0 1 ::: 0 1 ::: 0 1</b></p>
<p>Print the number on the opposing sides of a six sided die:</p>
<p><b>parallel --xapply -a <(seq 6) -a <(seq 6 -1 1) echo</b></p>
<p><b>parallel --xapply echo :::: <(seq 6) <(seq 6 -1 1)</b></p>
<p>Convert files from all subdirs to PNG-files with consecutive numbers (useful for making input PNG's for <b>ffmpeg</b>):</p>
<p><b>parallel --xapply -a <(find . -type f | sort) -a <(seq $(find . -type f|wc -l)) convert {1} {2}.png</b></p>
<p>Alternative version:</p>
<p><b>find . -type f | sort | parallel convert {} {#}.png</b></p>
<h1 id="EXAMPLE:-Use-a-table-as-input">EXAMPLE: Use a table as input</h1>
<p>Content of table_file.tsv:</p>
<pre><code> foo<TAB>bar
baz <TAB> quux</code></pre>
<p>To run:</p>
<pre><code> cmd -o bar -i foo
cmd -o quux -i baz</code></pre>
<p>you can run:</p>
<p><b>parallel -a table_file.tsv --colsep '\t' cmd -o {2} -i {1}</b></p>
<p>Note: The default for GNU <b>parallel</b> is to remove the spaces around the columns. To keep the spaces:</p>
<p><b>parallel -a table_file.tsv --trim n --colsep '\t' cmd -o {2} -i {1}</b></p>
<h1 id="EXAMPLE:-Run-the-same-command-10-times">EXAMPLE: Run the same command 10 times</h1>
<p>If you want to run the same command with the same arguments 10 times in parallel you can do:</p>
<p><b>seq 10 | parallel -n0 my_command my_args</b></p>
<h1 id="EXAMPLE:-Working-as-cat-sh.-Resource-inexpensive-jobs-and-evaluation">EXAMPLE: Working as cat | sh. Resource inexpensive jobs and evaluation</h1>
<p>GNU <b>parallel</b> can work similar to <b>cat | sh</b>.</p>
<p>A resource inexpensive job is a job that takes very little CPU, disk I/O and network I/O. Ping is an example of a resource inexpensive job. wget is too - if the webpages are small.</p>
<p>The content of the file jobs_to_run:</p>
<pre><code> ping -c 1 10.0.0.1
wget http://example.com/status.cgi?ip=10.0.0.1
ping -c 1 10.0.0.2
wget http://example.com/status.cgi?ip=10.0.0.2
...
ping -c 1 10.0.0.255
wget http://example.com/status.cgi?ip=10.0.0.255</code></pre>
<p>To run 100 processes simultaneously do:</p>
<p><b>parallel -j 100 < jobs_to_run</b></p>
<p>As there is not a <i>command</i> the jobs will be evaluated by the shell.</p>
<h1 id="EXAMPLE:-Processing-a-big-file-using-more-cores">EXAMPLE: Processing a big file using more cores</h1>
<p>To process a big file or some output you can use <b>--pipe</b> to split up the data into blocks and pipe the blocks into the processing program.</p>
<p>If the program is <b>gzip -9</b> you can do:</p>
<p><b>cat bigfile | parallel --pipe --recend '' -k gzip -9 </b>><b>bigfile.gz</b></p>
<p>This will split <b>bigfile</b> into blocks of 1 MB and pass that to <b>gzip -9</b> in parallel. One <b>gzip</b> will be run per CPU core. The output of <b>gzip -9</b> will be kept in order and saved to <b>bigfile.gz</b></p>
<p><b>gzip</b> works fine if the output is appended, but some processing does not work like that - for example sorting. For this GNU <b>parallel</b> can put the output of each command into a file. This will sort a big file in parallel:</p>
<p><b>cat bigfile | parallel --pipe --files sort | parallel -Xj1 sort -m {} ';' rm {} </b>><b>bigfile.sort</b></p>
<p>Here <b>bigfile</b> is split into blocks of around 1MB, each block ending in '\n' (which is the default for <b>--recend</b>). Each block is passed to <b>sort</b> and the output from <b>sort</b> is saved into files. These files are passed to the second <b>parallel</b> that runs <b>sort -m</b> on the files before it removes the files. The output is saved to <b>bigfile.sort</b>.</p>
<p>GNU <b>parallel</b>'s <b>--pipe</b> maxes out at around 100 MB/s because every byte has to be copied through GNU <b>parallel</b>. But if <b>bigfile</b> is a real (seekable) file GNU <b>parallel</b> can by-pass the copying and send the parts directly to the program:</p>
<p><b>parallel --pipepart --block 100m -a bigfile --files sort | parallel -Xj1 sort -m {} ';' rm {} </b>><b>bigfile.sort</b></p>
<h1 id="EXAMPLE:-Running-more-than-250-jobs-workaround">EXAMPLE: Running more than 250 jobs workaround</h1>
<p>If you need to run a massive amount of jobs in parallel, then you will likely hit the filehandle limit which is often around 250 jobs. If you are super user you can raise the limit in /etc/security/limits.conf but you can also use this workaround. The filehandle limit is per process. That means that if you just spawn more GNU <b>parallel</b>s then each of them can run 250 jobs. This will spawn up to 2500 jobs:</p>
<p><b>cat myinput | parallel --pipe -N 50 --round-robin -j50 parallel -j50 your_prg</b></p>
<p>This will spawn up to 62500 jobs (use with caution - you need 64 GB RAM to do this, and you may need to increase /proc/sys/kernel/pid_max):</p>
<p><b>cat myinput | parallel --pipe -N 250 --round-robin -j250 parallel -j250 your_prg</b></p>
<h1 id="EXAMPLE:-Working-as-mutex-and-counting-semaphore">EXAMPLE: Working as mutex and counting semaphore</h1>
<p>The command <b>sem</b> is an alias for <b>parallel --semaphore</b>.</p>
<p>A counting semaphore will allow a given number of jobs to be started in the background. When the number of jobs are running in the background, GNU <b>sem</b> will wait for one of these to complete before starting another command. <b>sem --wait</b> will wait for all jobs to complete.</p>
<p>Run 10 jobs concurrently in the background:</p>
<pre><code> for i in *.log ; do
echo $i
sem -j10 gzip $i ";" echo done
done
sem --wait</code></pre>
<p>A mutex is a counting semaphore allowing only one job to run. This will edit the file <i>myfile</i> and prepends the file with lines with the numbers 1 to 3.</p>
<pre><code> seq 3 | parallel sem sed -i -e 'i{}' myfile</code></pre>
<p>As <i>myfile</i> can be very big it is important only one process edits the file at the same time.</p>
<p>Name the semaphore to have multiple different semaphores active at the same time:</p>
<pre><code> seq 3 | parallel sem --id mymutex sed -i -e 'i{}' myfile</code></pre>
<h1 id="EXAMPLE:-Start-editor-with-filenames-from-stdin-standard-input">EXAMPLE: Start editor with filenames from stdin (standard input)</h1>
<p>You can use GNU <b>parallel</b> to start interactive programs like emacs or vi:</p>
<p><b>cat filelist | parallel --tty -X emacs</b></p>
<p><b>cat filelist | parallel --tty -X vi</b></p>
<p>If there are more files than will fit on a single command line, the editor will be started again with the remaining files.</p>
<h1 id="EXAMPLE:-Running-sudo">EXAMPLE: Running sudo</h1>
<p><b>sudo</b> requires a password to run a command as root. It caches the access, so you only need to enter the password again if you have not used <b>sudo</b> for a while.</p>
<p>The command:</p>
<pre><code> parallel sudo echo ::: This is a bad idea</code></pre>
<p>is no good, as you would be prompted for the sudo password for each of the jobs. You can either do:</p>
<pre><code> sudo echo This
parallel sudo echo ::: is a good idea</code></pre>
<p>or:</p>
<pre><code> sudo parallel echo ::: This is a good idea</code></pre>
<p>This way you only have to enter the sudo password once.</p>
<h1 id="EXAMPLE:-GNU-Parallel-as-queue-system-batch-manager">EXAMPLE: GNU Parallel as queue system/batch manager</h1>
<p>GNU <b>parallel</b> can work as a simple job queue system or batch manager. The idea is to put the jobs into a file and have GNU <b>parallel</b> read from that continuously. As GNU <b>parallel</b> will stop at end of file we use <b>tail</b> to continue reading:</p>
<p><b>true </b>><b>jobqueue</b>; <b>tail -n+0 -f jobqueue | parallel</b></p>
<p>To submit your jobs to the queue:</p>
<p><b>echo my_command my_arg </b>>><b> jobqueue</b></p>
<p>You can of course use <b>-S</b> to distribute the jobs to remote computers:</p>
<p><b>true </b>><b>jobqueue</b>; <b>tail -f jobqueue | parallel -S ..</b></p>
<p>There is a a small issue when using GNU <b>parallel</b> as queue system/batch manager: You have to submit JobSlot number of jobs before they will start, and after that you can submit one at a time, and job will start immediately if free slots are available. Output from the running or completed jobs are held back and will only be printed when JobSlots more jobs has been started (unless you use --ungroup or -u, in which case the output from the jobs are printed immediately). E.g. if you have 10 jobslots then the output from the first completed job will only be printed when job 11 has started, and the output of second completed job will only be printed when job 12 has started.</p>
<p>To use <b>--eof</b> to make GNU <b>parallel</b> exit, <b>tail</b> also needs to be forced to exit:</p>
<pre><code> tail -n+0 -f command-list.txt |
(parallel --eof=EXIT {}; echo Parallel is now done;
(seq 1000 >> command-list.txt &);
echo Done appending dummy data forcing tail to exit)</code></pre>
<h1 id="EXAMPLE:-GNU-Parallel-as-dir-processor">EXAMPLE: GNU Parallel as dir processor</h1>
<p>If you have a dir in which users drop files that needs to be processed you can do this on GNU/Linux (If you know what <b>inotifywait</b> is called on other platforms file a bug report):</p>
<p><b>inotifywait -q -m -r -e MOVED_TO -e CLOSE_WRITE --format %w%f my_dir | parallel -u echo</b></p>
<p>This will run the command <b>echo</b> on each file put into <b>my_dir</b> or subdirs of <b>my_dir</b>.</p>
<p>You can of course use <b>-S</b> to distribute the jobs to remote computers:</p>
<p><b>inotifywait -q -m -r -e MOVED_TO -e CLOSE_WRITE --format %w%f my_dir | parallel -S .. -u echo</b></p>
<p>If the files to be processed are in a tar file then unpacking one file and processing it immediately may be faster than first unpacking all files. Set up the dir processor as above and unpack into the dir.</p>
<p>Using GNU Parallel as dir processor has the same limitations as using GNU Parallel as queue system/batch manager.</p>
<h1 id="QUOTING">QUOTING</h1>
<p>GNU <b>parallel</b> is very liberal in quoting. You only need to quote characters that have special meaning in shell:</p>
<p>( ) $ ` ' " < > ; | \</p>
<p>and depending on context these needs to be quoted, too:</p>
<p>~ & # ! ? space * {</p>
<p>Therefore most people will never need more quoting than putting '\' in front of the special characters.</p>
<p>Often you can simply put \' around every ':</p>
<pre><code> perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"' file</code></pre>
<p>can be quoted:</p>
<pre><code> parallel perl -ne \''/^\S+\s+\S+$/ and print $ARGV,"\n"'\' ::: file</code></pre>
<p>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 <b>parallel</b> itself, so the evaluation of the $ must be done by the sub shell started by GNU <b>parallel</b>:</p>
<p><b>seq 10 | parallel -N2 echo seq:\$PARALLEL_SEQ arg1:{1} arg2:{2}</b></p>
<p>If the variable is set before GNU <b>parallel</b> starts you can do this:</p>
<p><b>VAR=this_is_set_before_starting</b></p>
<p><b>echo test | parallel echo {} $VAR</b></p>
<p>Prints: <b>test this_is_set_before_starting</b></p>
<p>It is a little more tricky if the variable contains more than one space in a row:</p>
<p><b>VAR="two spaces between each word"</b></p>
<p><b>echo test | parallel echo {} \'"$VAR"\'</b></p>
<p>Prints: <b>test two spaces between each word</b></p>
<p>If the variable should not be evaluated by the shell starting GNU <b>parallel</b> but be evaluated by the sub shell started by GNU <b>parallel</b>, then you need to quote it:</p>
<p><b>echo test | parallel VAR=this_is_set_after_starting \; echo {} \$VAR</b></p>
<p>Prints: <b>test this_is_set_after_starting</b></p>
<p>It is a little more tricky if the variable contains space:</p>
<p><b>echo test | parallel VAR='"two spaces between each word"' echo {} \'"$VAR"\'</b></p>
<p>Prints: <b>test two spaces between each word</b></p>
<p>$$ is the shell variable containing the process id of the shell. This will print the process id of the shell running GNU <b>parallel</b>:</p>
<p><b>seq 10 | parallel echo $$</b></p>
<p>And this will print the process ids of the sub shells started by GNU <b>parallel</b>.</p>
<p><b>seq 10 | parallel echo \$\$</b></p>
<p>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 <b>parallel</b> and the sub shell:</p>
<p><b>echo test | parallel echo {} \\\$VAR</b></p>
<p>Prints: <b>test $VAR</b></p>
<p>GNU <b>parallel</b> can protect against evaluation by the sub shell by using -q:</p>
<p><b>echo test | parallel -q echo {} \$VAR</b></p>
<p>Prints: <b>test $VAR</b></p>
<p>This is particularly useful if you have lots of quoting. If you want to run a perl script like this:</p>
<p><b>perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"' file</b></p>
<p>It needs to be quoted like this:</p>
<p><b>ls | parallel perl -ne '/^\\S+\\s+\\S+\$/\ and\ print\ \$ARGV,\"\\n\"'</b> <b>ls | parallel perl -ne \''/^\S+\s+\S+$/ and print $ARGV,"\n"'\'</b></p>
<p>Notice how spaces, \'s, "'s, and $'s need to be quoted. GNU <b>parallel</b> can do the quoting by using option -q:</p>
<p><b>ls | parallel -q perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"'</b></p>
<p>However, this means you cannot make the sub shell interpret special characters. For example because of <b>-q</b> this WILL NOT WORK:</p>
<p><b>ls *.gz | parallel -q "zcat {} </b>><b>{.}"</b></p>
<p><b>ls *.gz | parallel -q "zcat {} | bzip2 </b>><b>{.}.bz2"</b></p>
<p>because > and | need to be interpreted by the sub shell.</p>
<p>If you get errors like:</p>
<pre><code> 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</code></pre>
<p>then you might try using <b>-q</b>.</p>
<p>If you are using <b>bash</b> process substitution like <b><(cat foo)</b> then you may try <b>-q</b> and prepending <i>command</i> with <b>bash -c</b>:</p>
<p><b>ls | parallel -q bash -c 'wc -c <(echo {})'</b></p>
<p>Or for substituting output:</p>
<p><b>ls | parallel -q bash -c 'tar c {} | tee </b>><b>(gzip </b>><b>{}.tar.gz) | bzip2 </b>><b>{}.tar.bz2'</b></p>
<p><b>Conclusion</b>: To avoid dealing with the quoting problems it may be easier just to write a small script or a function (remember to <b>export -f</b> the function) and have GNU <b>parallel</b> call that.</p>
<h1 id="LIST-RUNNING-JOBS">LIST RUNNING JOBS</h1>
<p>If you want a list of the jobs currently running you can run:</p>
<p><b>killall -USR1 parallel</b></p>
<p>GNU <b>parallel</b> will then print the currently running jobs on stderr (standard error).</p>
<h1 id="COMPLETE-RUNNING-JOBS-BUT-DO-NOT-START-NEW-JOBS">COMPLETE RUNNING JOBS BUT DO NOT START NEW JOBS</h1>
<p>If you regret starting a lot of jobs you can simply break GNU <b>parallel</b>, but if you want to make sure you do not have half-completed jobs you should send the signal <b>SIGTERM</b> to GNU <b>parallel</b>:</p>
<p><b>killall -TERM parallel</b></p>
<p>This will tell GNU <b>parallel</b> to not start any new jobs, but wait until the currently running jobs are finished before exiting.</p>
<h1 id="ENVIRONMENT-VARIABLES">ENVIRONMENT VARIABLES</h1>
<dl>
<dt id="PARALLEL_PID">$PARALLEL_PID</dt>
<dd>
<p>The environment variable $PARALLEL_PID is set by GNU <b>parallel</b> and is visible to the jobs started from GNU <b>parallel</b>. This makes it possible for the jobs to communicate directly to GNU <b>parallel</b>. Remember to quote the $, so it gets evaluated by the correct shell.</p>
<p><b>Example:</b> If each of the jobs tests a solution and one of jobs finds the solution the job can tell GNU <b>parallel</b> not to start more jobs by: <b>kill -TERM $PARALLEL_PID</b>. This only works on the local computer.</p>
</dd>
<dt id="PARALLEL_SHELL-alpha-testing">$PARALLEL_SHELL (alpha testing)</dt>
<dd>
<p>Use this shell the shell for the commands run by GNU Parallel:</p>
<ul>
<li><p>$PARALLEL_SHELL. If undefined use:</p>
</li>
<li><p>The shell that started GNU Parallel. If that cannot be determined:</p>
</li>
<li><p>$SHELL. If undefined use:</p>
</li>
<li><p>/bin/sh</p>
</li>
</ul>
</dd>
<dt id="PARALLEL_SEQ">$PARALLEL_SEQ</dt>
<dd>
<p>$PARALLEL_SEQ will be set to the sequence number of the job running. Remember to quote the $, so it gets evaluated by the correct shell.</p>
<p><b>Example:</b></p>
<p><b>seq 10 | parallel -N2 echo seq:'$'PARALLEL_SEQ arg1:{1} arg2:{2}</b></p>
</dd>
<dt id="TMPDIR">$TMPDIR</dt>
<dd>
<p>Directory for temporary files. See: <b>--tmpdir</b>.</p>
</dd>
<dt id="PARALLEL">$PARALLEL</dt>
<dd>
<p>The environment variable $PARALLEL will be used as default options for GNU <b>parallel</b>. If the variable contains special shell characters (e.g. $, *, or space) then these need to be to be escaped with \.</p>
<p><b>Example:</b></p>
<p><b>cat list | parallel -j1 -k -v ls</b></p>
<p>can be written as:</p>
<p><b>cat list | PARALLEL="-kvj1" parallel ls</b></p>
<p><b>cat list | parallel -j1 -k -v -S"myssh user@server" ls</b></p>
<p>can be written as:</p>
<p><b>cat list | PARALLEL='-kvj1 -S myssh\ user@server' parallel echo</b></p>
<p>Notice the \ in the middle is needed because 'myssh' and 'user@server' must be one argument.</p>
</dd>
</dl>
<h1 id="DEFAULT-PROFILE-CONFIG-FILE">DEFAULT PROFILE (CONFIG FILE)</h1>
<p>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.</p>
<p>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.</p>
<p>Note that no file that is read for options, nor the environment variable $PARALLEL, may contain retired options such as <b>--tollef</b>.</p>
<h1 id="PROFILE-FILES">PROFILE FILES</h1>
<p>If <b>--profile</b> set, GNU <b>parallel</b> will read the profile from that file rather than the global or user configuration files. You can have multiple <b>--profiles</b>.</p>
<p>Example: Profile for running a command on every sshlogin in ~/.ssh/sshlogins and prepend the output with the sshlogin:</p>
<pre><code> echo --tag -S .. --nonall > ~/.parallel/n
parallel -Jn uptime</code></pre>
<p>Example: Profile for running every command with <b>-j-1</b> and <b>nice</b></p>
<pre><code> echo -j-1 nice > ~/.parallel/nice_profile
parallel -J nice_profile bzip2 -9 ::: *</code></pre>
<p>Example: Profile for running a perl script before every command:</p>
<pre><code> echo "perl -e '\$a=\$\$; print \$a,\" \",'\$PARALLEL_SEQ',\" \";';" > ~/.parallel/pre_perl
parallel -J pre_perl echo ::: *</code></pre>
<p>Note how the $ and " need to be quoted using \.</p>
<p>Example: Profile for running distributed jobs with <b>nice</b> on the remote computers:</p>
<pre><code> echo -S .. nice > ~/.parallel/dist
parallel -J dist --trc {.}.bz2 bzip2 -9 ::: *</code></pre>
<h1 id="EXIT-STATUS">EXIT STATUS</h1>
<p>If <b>--halt-on-error</b> 0 or not specified:</p>
<dl>
<dt id="pod01">0</dt>
<dd>
<p>All jobs ran without error.</p>
</dd>
<dt id="pod1-253">1-253</dt>
<dd>
<p>Some of the jobs failed. The exit status gives the number of failed jobs</p>
</dd>
<dt id="pod254">254</dt>
<dd>
<p>More than 253 jobs failed.</p>
</dd>
<dt id="pod255">255</dt>
<dd>
<p>Other error.</p>
</dd>
</dl>
<p>If <b>--halt-on-error</b> 1 or 2: Exit status of the failing job.</p>
<h1 id="DIFFERENCES-BETWEEN-GNU-Parallel-AND-ALTERNATIVES">DIFFERENCES BETWEEN GNU Parallel AND ALTERNATIVES</h1>
<p>There are a lot programs with some of the functionality of GNU <b>parallel</b>. GNU <b>parallel</b> strives to include the best of the functionality without sacrificing ease of use.</p>
<h2 id="SUMMARY-TABLE">SUMMARY TABLE</h2>
<p>The following features are in some of the comparable tools:</p>
<p>Inputs I1. Arguments can be read from stdin I2. Arguments can be read from a file I3. Arguments can be read from multiple files I4. Arguments can be read from command line I5. Arguments can be read from a table I6. Arguments can be read from the same file using #! (shebang) I7. Line oriented input as default (Quoting of special chars not needed)</p>
<p>Manipulation of input M1. Composed command M2. Multiple arguments can fill up an execution line M3. Arguments can be put anywhere in the execution line M4. Multiple arguments can be put anywhere in the execution line M5. Arguments can be replaced with context M6. Input can be treated as complete execution line</p>
<p>Outputs O1. Grouping output so output from different jobs do not mix O2. Send stderr (standard error) to stderr (standard error) O3. Send stdout (standard output) to stdout (standard output) O4. Order of output can be same as order of input O5. Stdout only contains stdout (standard output) from the command O6. Stderr only contains stderr (standard error) from the command</p>
<p>Execution E1. Running jobs in parallel E2. List running jobs E3. Finish running jobs, but do not start new jobs E4. Number of running jobs can depend on number of cpus E5. Finish running jobs, but do not start new jobs after first failure E6. Number of running jobs can be adjusted while running</p>
<p>Remote execution R1. Jobs can be run on remote computers R2. Basefiles can be transferred R3. Argument files can be transferred R4. Result files can be transferred R5. Cleanup of transferred files R6. No config files needed R7. Do not run more than SSHD's MaxStartups can handle R8. Configurable SSH command R9. Retry if connection breaks occasionally</p>
<p>Semaphore S1. Possibility to work as a mutex S2. Possibility to work as a counting semaphore</p>
<p>Legend - = no x = not applicable ID = yes</p>
<p>As every new version of the programs are not tested the table may be outdated. Please file a bug-report if you find errors (See REPORTING BUGS).</p>
<p>parallel: I1 I2 I3 I4 I5 I6 I7 M1 M2 M3 M4 M5 M6 O1 O2 O3 O4 O5 O6 E1 E2 E3 E4 E5 E6 R1 R2 R3 R4 R5 R6 R7 R8 R9 S1 S2</p>
<p>xargs: I1 I2 - - - - - - M2 M3 - - - - O2 O3 - O5 O6 E1 - - - - - - - - - - x - - - - -</p>
<p>find -exec: - - - x - x - - M2 M3 - - - - - O2 O3 O4 O5 O6 - - - - - - - - - - - - - - - - x x</p>
<p>make -j: - - - - - - - - - - - - - O1 O2 O3 - x O6 E1 - - - E5 - - - - - - - - - - - -</p>
<p>ppss: I1 I2 - - - - I7 M1 - M3 - - M6 O1 - - x - - E1 E2 ?E3 E4 - - R1 R2 R3 R4 - - ?R7 ? ? - -</p>
<p>pexec: I1 I2 - I4 I5 - - M1 - M3 - - M6 O1 O2 O3 - O5 O6 E1 - - E4 - E6 R1 - - - - R6 - - - S1 -</p>
<p>xjobs: TODO - Please file a bug-report if you know what features xjobs supports (See REPORTING BUGS).</p>
<p>prll: TODO - Please file a bug-report if you know what features prll supports (See REPORTING BUGS).</p>
<p>dxargs: TODO - Please file a bug-report if you know what features dxargs supports (See REPORTING BUGS).</p>
<p>mdm/middelman: TODO - Please file a bug-report if you know what features mdm/middelman supports (See REPORTING BUGS).</p>
<p>xapply: TODO - Please file a bug-report if you know what features xapply supports (See REPORTING BUGS).</p>
<p>paexec: TODO - Please file a bug-report if you know what features paexec supports (See REPORTING BUGS).</p>
<p>ladon: TODO - Please file a bug-report if you know what features ladon supports (See REPORTING BUGS).</p>
<p>ClusterSSH: TODO - Please file a bug-report if you know what features ClusterSSH supports (See REPORTING BUGS).</p>
<h2 id="DIFFERENCES-BETWEEN-xargs-AND-GNU-Parallel">DIFFERENCES BETWEEN xargs AND GNU Parallel</h2>
<p><b>xargs</b> offers some of the same possibilities as GNU <b>parallel</b>.</p>
<p><b>xargs</b> deals badly with special characters (such as space, ' and "). To see the problem try this:</p>
<pre><code> touch important_file
touch 'not important_file'
ls not* | xargs rm
mkdir -p "My brother's 12\" records"
ls | xargs rmdir</code></pre>
<p>You can specify <b>-0</b> or <b>-d "\n"</b>, but many input generators are not optimized for using <b>NUL</b> as separator but are optimized for <b>newline</b> as separator. E.g <b>head</b>, <b>tail</b>, <b>awk</b>, <b>ls</b>, <b>echo</b>, <b>sed</b>, <b>tar -v</b>, <b>perl</b> (<b>-0</b> and \0 instead of \n), <b>locate</b> (requires using <b>-0</b>), <b>find</b> (requires using <b>-print0</b>), <b>grep</b> (requires user to use <b>-z</b> or <b>-Z</b>), <b>sort</b> (requires using <b>-z</b>).</p>
<p>So GNU <b>parallel</b>'s newline separation can be emulated with:</p>
<p><b>cat | xargs -d "\n" -n1 <i>command</i></b></p>
<p><b>xargs</b> can run a given number of jobs in parallel, but has no support for running number-of-cpu-cores jobs in parallel.</p>
<p><b>xargs</b> has no support for grouping the output, therefore output may run together, e.g. the first half of a line is from one process and the last half of the line is from another process. The example <b>Parallel grep</b> cannot be done reliably with <b>xargs</b> because of this. To see this in action try:</p>
<pre><code> parallel perl -e '\$a=\"1{}\"x10000000\;print\ \$a,\"\\n\"' '>' {} ::: a b c d e f
ls -l a b c d e f
parallel -kP4 -n1 grep 1 > out.par ::: a b c d e f
echo a b c d e f | xargs -P4 -n1 grep 1 > out.xargs-unbuf
echo a b c d e f | xargs -P4 -n1 grep --line-buffered 1 > out.xargs-linebuf
echo a b c d e f | xargs -n1 grep 1 > out.xargs-serial
ls -l out*
md5sum out*</code></pre>
<p><b>xargs</b> has no support for keeping the order of the output, therefore if running jobs in parallel using <b>xargs</b> the output of the second job cannot be postponed till the first job is done.</p>
<p><b>xargs</b> has no support for running jobs on remote computers.</p>
<p><b>xargs</b> has no support for context replace, so you will have to create the arguments.</p>
<p>If you use a replace string in <b>xargs</b> (<b>-I</b>) you can not force <b>xargs</b> to use more than one argument.</p>
<p>Quoting in <b>xargs</b> works like <b>-q</b> in GNU <b>parallel</b>. This means composed commands and redirection require using <b>bash -c</b>.</p>
<p><b>ls | parallel "wc {} </b>> <b>{}.wc"</b></p>
<p>becomes (assuming you have 8 cores)</p>
<p><b>ls | xargs -d "\n" -P8 -I {} bash -c "wc {} </b>><b> {}.wc"</b></p>
<p>and</p>
<p><b>ls | parallel "echo {}; ls {}|wc"</b></p>
<p>becomes (assuming you have 8 cores)</p>
<p><b>ls | xargs -d "\n" -P8 -I {} bash -c "echo {}; ls {}|wc"</b></p>
<h2 id="DIFFERENCES-BETWEEN-find--exec-AND-GNU-Parallel">DIFFERENCES BETWEEN find -exec AND GNU Parallel</h2>
<p><b>find -exec</b> offer some of the same possibilities as GNU <b>parallel</b>.</p>
<p><b>find -exec</b> only works on files. So processing other input (such as hosts or URLs) will require creating these inputs as files. <b>find -exec</b> has no support for running commands in parallel.</p>
<h2 id="DIFFERENCES-BETWEEN-make--j-AND-GNU-Parallel">DIFFERENCES BETWEEN make -j AND GNU Parallel</h2>
<p><b>make -j</b> can run jobs in parallel, but requires a crafted Makefile to do this. That results in extra quoting to get filename containing newline to work correctly.</p>
<p><b>make -j</b> has no support for grouping the output, therefore output may run together, e.g. the first half of a line is from one process and the last half of the line is from another process. The example <b>Parallel grep</b> cannot be done reliably with <b>make -j</b> because of this.</p>
<p>(Very early versions of GNU <b>parallel</b> were coincidently implemented using <b>make -j</b>).</p>
<h2 id="DIFFERENCES-BETWEEN-ppss-AND-GNU-Parallel">DIFFERENCES BETWEEN ppss AND GNU Parallel</h2>
<p><b>ppss</b> is also a tool for running jobs in parallel.</p>
<p>The output of <b>ppss</b> is status information and thus not useful for using as input for another command. The output from the jobs are put into files.</p>
<p>The argument replace string ($ITEM) cannot be changed. Arguments must be quoted - thus arguments containing special characters (space '"&!*) may cause problems. More than one argument is not supported. File names containing newlines are not processed correctly. When reading input from a file null cannot be used as a terminator. <b>ppss</b> needs to read the whole input file before starting any jobs.</p>
<p>Output and status information is stored in ppss_dir and thus requires cleanup when completed. If the dir is not removed before running <b>ppss</b> again it may cause nothing to happen as <b>ppss</b> thinks the task is already done. GNU <b>parallel</b> will normally not need cleaning up if running locally and will only need cleaning up if stopped abnormally and running remote (<b>--cleanup</b> may not complete if stopped abnormally). The example <b>Parallel grep</b> would require extra postprocessing if written using <b>ppss</b>.</p>
<p>For remote systems PPSS requires 3 steps: config, deploy, and start. GNU <b>parallel</b> only requires one step.</p>
<h3 id="EXAMPLES-FROM-ppss-MANUAL">EXAMPLES FROM ppss MANUAL</h3>
<p>Here are the examples from <b>ppss</b>'s manual page with the equivalent using GNU <b>parallel</b>:</p>
<p><b>1</b> ./ppss.sh standalone -d /path/to/files -c 'gzip '</p>
<p><b>1</b> find /path/to/files -type f | parallel gzip</p>
<p><b>2</b> ./ppss.sh standalone -d /path/to/files -c 'cp "$ITEM" /destination/dir '</p>
<p><b>2</b> find /path/to/files -type f | parallel cp {} /destination/dir</p>
<p><b>3</b> ./ppss.sh standalone -f list-of-urls.txt -c 'wget -q '</p>
<p><b>3</b> parallel -a list-of-urls.txt wget -q</p>
<p><b>4</b> ./ppss.sh standalone -f list-of-urls.txt -c 'wget -q "$ITEM"'</p>
<p><b>4</b> parallel -a list-of-urls.txt wget -q {}</p>
<p><b>5</b> ./ppss config -C config.cfg -c 'encode.sh ' -d /source/dir -m 192.168.1.100 -u ppss -k ppss-key.key -S ./encode.sh -n nodes.txt -o /some/output/dir --upload --download ; ./ppss deploy -C config.cfg ; ./ppss start -C config</p>
<p><b>5</b> # parallel does not use configs. If you want a different username put it in nodes.txt: user@hostname</p>
<p><b>5</b> find source/dir -type f | parallel --sshloginfile nodes.txt --trc {.}.mp3 lame -a {} -o {.}.mp3 --preset standard --quiet</p>
<p><b>6</b> ./ppss stop -C config.cfg</p>
<p><b>6</b> killall -TERM parallel</p>
<p><b>7</b> ./ppss pause -C config.cfg</p>
<p><b>7</b> Press: CTRL-Z or killall -SIGTSTP parallel</p>
<p><b>8</b> ./ppss continue -C config.cfg</p>
<p><b>8</b> Enter: fg or killall -SIGCONT parallel</p>
<p><b>9</b> ./ppss.sh status -C config.cfg</p>
<p><b>9</b> killall -SIGUSR2 parallel</p>
<h2 id="DIFFERENCES-BETWEEN-pexec-AND-GNU-Parallel">DIFFERENCES BETWEEN pexec AND GNU Parallel</h2>
<p><b>pexec</b> is also a tool for running jobs in parallel.</p>
<h3 id="EXAMPLES-FROM-pexec-MANUAL">EXAMPLES FROM pexec MANUAL</h3>
<p>Here are the examples from <b>pexec</b>'s info page with the equivalent using GNU <b>parallel</b>:</p>
<p><b>1</b> pexec -o sqrt-%s.dat -p "$(seq 10)" -e NUM -n 4 -c -- \ 'echo "scale=10000;sqrt($NUM)" | bc'</p>
<p><b>1</b> seq 10 | parallel -j4 'echo "scale=10000;sqrt({})" | bc > sqrt-{}.dat'</p>
<p><b>2</b> pexec -p "$(ls myfiles*.ext)" -i %s -o %s.sort -- sort</p>
<p><b>2</b> ls myfiles*.ext | parallel sort {} ">{}.sort"</p>
<p><b>3</b> pexec -f image.list -n auto -e B -u star.log -c -- \ 'fistar $B.fits -f 100 -F id,x,y,flux -o $B.star'</p>
<p><b>3</b> parallel -a image.list \ 'fistar {}.fits -f 100 -F id,x,y,flux -o {}.star' 2>star.log</p>
<p><b>4</b> pexec -r *.png -e IMG -c -o - -- \ 'convert $IMG ${IMG%.png}.jpeg ; "echo $IMG: done"'</p>
<p><b>4</b> ls *.png | parallel 'convert {} {.}.jpeg; echo {}: done'</p>
<p><b>5</b> pexec -r *.png -i %s -o %s.jpg -c 'pngtopnm | pnmtojpeg'</p>
<p><b>5</b> ls *.png | parallel 'pngtopnm < {} | pnmtojpeg > {}.jpg'</p>
<p><b>6</b> for p in *.png ; do echo ${p%.png} ; done | \ pexec -f - -i %s.png -o %s.jpg -c 'pngtopnm | pnmtojpeg'</p>
<p><b>6</b> ls *.png | parallel 'pngtopnm < {} | pnmtojpeg > {.}.jpg'</p>
<p><b>7</b> LIST=$(for p in *.png ; do echo ${p%.png} ; done) pexec -r $LIST -i %s.png -o %s.jpg -c 'pngtopnm | pnmtojpeg'</p>
<p><b>7</b> ls *.png | parallel 'pngtopnm < {} | pnmtojpeg > {.}.jpg'</p>
<p><b>8</b> pexec -n 8 -r *.jpg -y unix -e IMG -c \ 'pexec -j -m blockread -d $IMG | \ jpegtopnm | pnmscale 0.5 | pnmtojpeg | \ pexec -j -m blockwrite -s th_$IMG'</p>
<p><b>8</b> Combining GNU <b>parallel</b> and GNU <b>sem</b>.</p>
<p><b>8</b> ls *jpg | parallel -j8 'sem --id blockread cat {} | jpegtopnm |' \ 'pnmscale 0.5 | pnmtojpeg | sem --id blockwrite cat > th_{}'</p>
<p><b>8</b> If reading and writing is done to the same disk, this may be faster as only one process will be either reading or writing:</p>
<p><b>8</b> ls *jpg | parallel -j8 'sem --id diskio cat {} | jpegtopnm |' \ 'pnmscale 0.5 | pnmtojpeg | sem --id diskio cat > th_{}'</p>
<h2 id="DIFFERENCES-BETWEEN-xjobs-AND-GNU-Parallel">DIFFERENCES BETWEEN xjobs AND GNU Parallel</h2>
<p><b>xjobs</b> is also a tool for running jobs in parallel. It only supports running jobs on your local computer.</p>
<p><b>xjobs</b> deals badly with special characters just like <b>xargs</b>. See the section <b>DIFFERENCES BETWEEN xargs AND GNU Parallel</b>.</p>
<p>Here are the examples from <b>xjobs</b>'s man page with the equivalent using GNU <b>parallel</b>:</p>
<p><b>1</b> ls -1 *.zip | xjobs unzip</p>
<p><b>1</b> ls *.zip | parallel unzip</p>
<p><b>2</b> ls -1 *.zip | xjobs -n unzip</p>
<p><b>2</b> ls *.zip | parallel unzip >/dev/null</p>
<p><b>3</b> find . -name '*.bak' | xjobs gzip</p>
<p><b>3</b> find . -name '*.bak' | parallel gzip</p>
<p><b>4</b> ls -1 *.jar | sed 's/\(.*\)/\1 > \1.idx/' | xjobs jar tf</p>
<p><b>4</b> ls *.jar | parallel jar tf {} '>' {}.idx</p>
<p><b>5</b> xjobs -s script</p>
<p><b>5</b> cat script | parallel</p>
<p><b>6</b> mkfifo /var/run/my_named_pipe; xjobs -s /var/run/my_named_pipe & echo unzip 1.zip >> /var/run/my_named_pipe; echo tar cf /backup/myhome.tar /home/me >> /var/run/my_named_pipe</p>
<p><b>6</b> mkfifo /var/run/my_named_pipe; cat /var/run/my_named_pipe | parallel & echo unzip 1.zip >> /var/run/my_named_pipe; echo tar cf /backup/myhome.tar /home/me >> /var/run/my_named_pipe</p>
<h2 id="DIFFERENCES-BETWEEN-prll-AND-GNU-Parallel">DIFFERENCES BETWEEN prll AND GNU Parallel</h2>
<p><b>prll</b> is also a tool for running jobs in parallel. It does not support running jobs on remote computers.</p>
<p><b>prll</b> encourages using BASH aliases and BASH functions instead of scripts. GNU <b>parallel</b> will never support running aliases (see why http://www.perlmonks.org/index.pl?node_id=484296). However, scripts, composed commands, or functions exported with <b>export -f</b> work just fine.</p>
<p><b>prll</b> generates a lot of status information on stderr (standard error) which makes it harder to use the stderr (standard error) output of the job directly as input for another program.</p>
<p>Here is the example from <b>prll</b>'s man page with the equivalent using GNU <b>parallel</b>:</p>
<p>prll -s 'mogrify -flip $1' *.jpg</p>
<p>parallel mogrify -flip ::: *.jpg</p>
<h2 id="DIFFERENCES-BETWEEN-dxargs-AND-GNU-Parallel">DIFFERENCES BETWEEN dxargs AND GNU Parallel</h2>
<p><b>dxargs</b> is also a tool for running jobs in parallel.</p>
<p><b>dxargs</b> does not deal well with more simultaneous jobs than SSHD's MaxStartups. <b>dxargs</b> is only built for remote run jobs, but does not support transferring of files.</p>
<h2 id="DIFFERENCES-BETWEEN-mdm-middleman-AND-GNU-Parallel">DIFFERENCES BETWEEN mdm/middleman AND GNU Parallel</h2>
<p>middleman(mdm) is also a tool for running jobs in parallel.</p>
<p>Here are the shellscripts of http://mdm.berlios.de/usage.html ported to GNU <b>parallel</b>:</p>
<p><b>seq 19 | parallel buffon -o - | sort -n </b>><b> result</b></p>
<p><b>cat files | parallel cmd</b></p>
<p><b>find dir -execdir sem cmd {} \;</b></p>
<h2 id="DIFFERENCES-BETWEEN-xapply-AND-GNU-Parallel">DIFFERENCES BETWEEN xapply AND GNU Parallel</h2>
<p><b>xapply</b> can run jobs in parallel on the local computer.</p>
<p>Here are the examples from <b>xapply</b>'s man page with the equivalent using GNU <b>parallel</b>:</p>
<p><b>1</b> xapply '(cd %1 && make all)' */</p>
<p><b>1</b> parallel 'cd {} && make all' ::: */</p>
<p><b>2</b> xapply -f 'diff %1 ../version5/%1' manifest | more</p>
<p><b>2</b> parallel diff {} ../version5/{} < manifest | more</p>
<p><b>3</b> xapply -p/dev/null -f 'diff %1 %2' manifest1 checklist1</p>
<p><b>3</b> parallel --xapply diff {1} {2} :::: manifest1 checklist1</p>
<p><b>4</b> xapply 'indent' *.c</p>
<p><b>4</b> parallel indent ::: *.c</p>
<p><b>5</b> find ~ksb/bin -type f ! -perm -111 -print | xapply -f -v 'chmod a+x' -</p>
<p><b>5</b> find ~ksb/bin -type f ! -perm -111 -print | parallel -v chmod a+x</p>
<p><b>6</b> find */ -... | fmt 960 1024 | xapply -f -i /dev/tty 'vi' -</p>
<p><b>6</b> sh <(find */ -... | parallel -s 1024 echo vi)</p>
<p><b>6</b> find */ -... | parallel -s 1024 -Xuj1 vi</p>
<p><b>7</b> find ... | xapply -f -5 -i /dev/tty 'vi' - - - - -</p>
<p><b>7</b> sh <(find ... |parallel -n5 echo vi)</p>
<p><b>7</b> find ... |parallel -n5 -uj1 vi</p>
<p><b>8</b> xapply -fn "" /etc/passwd</p>
<p><b>8</b> parallel -k echo < /etc/passwd</p>
<p><b>9</b> tr ':' '\012' < /etc/passwd | xapply -7 -nf 'chown %1 %6' - - - - - - -</p>
<p><b>9</b> tr ':' '\012' < /etc/passwd | parallel -N7 chown {1} {6}</p>
<p><b>10</b> xapply '[ -d %1/RCS ] || echo %1' */</p>
<p><b>10</b> parallel '[ -d {}/RCS ] || echo {}' ::: */</p>
<p><b>11</b> xapply -f '[ -f %1 ] && echo %1' List | ...</p>
<p><b>11</b> parallel '[ -f {} ] && echo {}' < List | ...</p>
<h2 id="DIFFERENCES-BETWEEN-paexec-AND-GNU-Parallel">DIFFERENCES BETWEEN paexec AND GNU Parallel</h2>
<p><b>paexec</b> can run jobs in parallel on both the local and remote computers.</p>
<p><b>paexec</b> requires commands to print a blank line as the last output. This means you will have to write a wrapper for most programs.</p>
<p><b>paexec</b> has a job dependency facility so a job can depend on another job to be executed successfully. Sort of a poor-man's <b>make</b>.</p>
<p>Here are the examples from <b>paexec</b>'s example catalog with the equivalent using GNU <b>parallel</b>:</p>
<dl>
<dt id="div_X_run">1_div_X_run:</dt>
<dd>
<pre><code> ../../paexec -s -l -c "`pwd`/1_div_X_cmd" -n +1 <<EOF [...]
parallel echo {} '|' `pwd`/1_div_X_cmd <<EOF [...]</code></pre>
</dd>
<dt id="all_substr_run">all_substr_run:</dt>
<dd>
<pre><code> ../../paexec -lp -c "`pwd`/all_substr_cmd" -n +3 <<EOF [...]
parallel echo {} '|' `pwd`/all_substr_cmd <<EOF [...]</code></pre>
</dd>
<dt id="cc_wrapper_run">cc_wrapper_run:</dt>
<dd>
<pre><code> ../../paexec -c "env CC=gcc CFLAGS=-O2 `pwd`/cc_wrapper_cmd" \
-n 'host1 host2' \
-t '/usr/bin/ssh -x' <<EOF [...]
parallel echo {} '|' "env CC=gcc CFLAGS=-O2 `pwd`/cc_wrapper_cmd" \
-S host1,host2 <<EOF [...]
# This is not exactly the same, but avoids the wrapper
parallel gcc -O2 -c -o {.}.o {} \
-S host1,host2 <<EOF [...]</code></pre>
</dd>
<dt id="toupper_run">toupper_run:</dt>
<dd>
<pre><code> ../../paexec -lp -c "`pwd`/toupper_cmd" -n +10 <<EOF [...]
parallel echo {} '|' ./toupper_cmd <<EOF [...]
# Without the wrapper:
parallel echo {} '| awk {print\ toupper\(\$0\)}' <<EOF [...]</code></pre>
</dd>
</dl>
<h2 id="DIFFERENCES-BETWEEN-map-AND-GNU-Parallel">DIFFERENCES BETWEEN map AND GNU Parallel</h2>
<p><b>map</b> sees it as a feature to have less features and in doing so it also handles corner cases incorrectly. A lot of GNU <b>parallel</b>'s code is to handle corner cases correctly on every platform, so you will not get a nasty surprise if a user for example saves a file called: <i>My brother's 12" records.txt</i></p>
<p><b>map</b>'s example showing how to deal with special characters fails on special characters:</p>
<pre><code> echo "The Cure" > My\ brother\'s\ 12\"\ records
ls | map 'echo -n `gzip < "%" | wc -c`; echo -n '*100/'; wc -c < "%"' | bc</code></pre>
<p>It works with GNU <b>parallel</b>:</p>
<pre><code> ls | parallel 'echo -n `gzip < {} | wc -c`; echo -n '*100/'; wc -c < {}' | bc</code></pre>
<p>And you can even get the file name prepended:</p>
<pre><code> ls | parallel --tag '(echo -n `gzip < {} | wc -c`'*100/'; wc -c < {}) | bc'</code></pre>
<p><b>map</b> has no support for grouping. So this gives the wrong results without any warnings:</p>
<pre><code> parallel perl -e '\$a=\"1{}\"x10000000\;print\ \$a,\"\\n\"' '>' {} ::: a b c d e f
ls -l a b c d e f
parallel -kP4 -n1 grep 1 > out.par ::: a b c d e f
map -p 4 'grep 1' a b c d e f > out.map-unbuf
map -p 4 'grep --line-buffered 1' a b c d e f > out.map-linebuf
map -p 1 'grep --line-buffered 1' a b c d e f > out.map-serial
ls -l out*
md5sum out*</code></pre>
<p>The documentation shows a workaround, but not only does that mix stdout (standard output) with stderr (standard error) it also fails completely for certain jobs (and may even be considered less readable):</p>
<pre><code> parallel echo -n {} ::: 1 2 3
map -p 4 'echo -n % 2>&1 | sed -e "s/^/$$:/"' 1 2 3 | sort | cut -f2- -d:</code></pre>
<p><b>map</b> cannot handle bundled options: <b>map -vp 0 echo this fails</b></p>
<p><b>map</b> does not have an argument separator on the command line, but uses the first argument as command. This makes quoting harder which again may affect readability. Compare:</p>
<pre><code> map -p 2 perl\\\ -ne\\\ \\\'/^\\\\S+\\\\s+\\\\S+\\\$/\\\ and\\\ print\\\ \\\$ARGV,\\\"\\\\n\\\"\\\' *
parallel -q perl -ne '/^\S+\s+\S+$/ and print $ARGV,"\n"' ::: *</code></pre>
<p><b>map</b> can do multiple arguments with context replace, but not without context replace:</p>
<pre><code> parallel --xargs echo 'BEGIN{'{}'}END' ::: 1 2 3</code></pre>
<p><b>map</b> does not set exit value according to whether one of the jobs failed:</p>
<pre><code> parallel false ::: 1 || echo Job failed
map false 1 || echo Never run</code></pre>
<p><b>map</b> requires Perl v5.10.0 making it harder to use on old systems.</p>
<p><b>map</b> has no way of using % in the command (GNU Parallel has -I to specify another replacement string than {}).</p>
<p>By design <b>map</b> is option incompatible with <b>xargs</b>, it does not have remote job execution, a structured way of saving results, multiple input sources, progress indicator, configurable record delimiter (only field delimiter), logging of jobs run with possibility to resume, keeping the output in the same order as input, --pipe processing, and dynamically timeouts.</p>
<h2 id="DIFFERENCES-BETWEEN-ladon-AND-GNU-Parallel">DIFFERENCES BETWEEN ladon AND GNU Parallel</h2>
<p><b>ladon</b> can run multiple jobs on files in parallel.</p>
<p><b>ladon</b> only works on files and the only way to specify files is using a quoted glob string (such as \*.jpg). It is not possible to list the files manually.</p>
<p>As replacement strings it uses FULLPATH DIRNAME BASENAME EXT RELDIR RELPATH</p>
<p>These can be simulated using GNU <b>parallel</b> by putting this in <b>~/.parallel/config</b>:</p>
<pre><code> --rpl 'FULLPATH $_=::shell_quote($_);chomp($_=qx{readlink -f $_});'
--rpl 'DIRNAME $_=::shell_quote(::dirname($_));chomp($_=qx{readlink -f $_});'
--rpl 'BASENAME s:.*/::;s:\.[^/.]+$::;'
--rpl 'EXT s:.*\.::'
--rpl 'RELDIR $_=::shell_quote($_);chomp(($_,$c)=qx{readlink -f $_;pwd});s:\Q$c/\E::;$_=::dirname($_);'
--rpl 'RELPATH $_=::shell_quote($_);chomp(($_,$c)=qx{readlink -f $_;pwd});s:\Q$c/\E::;'</code></pre>
<p><b>ladon</b> deals badly with filenames containing " and newline, and it fails for output larger than 200k:</p>
<pre><code> ladon '*' -- seq 36000 | wc</code></pre>
<h3 id="EXAMPLES-FROM-ladon-MANUAL">EXAMPLES FROM ladon MANUAL</h3>
<p>It is assumed that the '--rpl's above are put in <b>~/.parallel/config</b> and that it is run under a shell that supports '**' globbing (such as <b>zsh</b>):</p>
<p><b>1</b> ladon "**/*.txt" -- echo RELPATH</p>
<p><b>1</b> parallel echo RELPATH ::: **/*.txt</p>
<p><b>2</b> ladon "~/Documents/**/*.pdf" -- shasum FULLPATH >hashes.txt</p>
<p><b>2</b> parallel shasum FULLPATH ::: ~/Documents/**/*.pdf >hashes.txt</p>
<p><b>3</b> ladon -m thumbs/RELDIR "**/*.jpg" -- convert FULLPATH -thumbnail 100x100^ -gravity center -extent 100x100 thumbs/RELPATH</p>
<p><b>3</b> parallel mkdir -p thumbs/RELDIR\; convert FULLPATH -thumbnail 100x100^ -gravity center -extent 100x100 thumbs/RELPATH ::: **/*.jpg</p>
<p><b>4</b> ladon "~/Music/*.wav" -- lame -V 2 FULLPATH DIRNAME/BASENAME.mp3</p>
<p><b>4</b> parallel lame -V 2 FULLPATH DIRNAME/BASENAME.mp3 ::: ~/Music/*.wav</p>
<h2 id="DIFFERENCES-BETWEEN-ClusterSSH-AND-GNU-Parallel">DIFFERENCES BETWEEN ClusterSSH AND GNU Parallel</h2>
<p>ClusterSSH solves a different problem than GNU <b>parallel</b>.</p>
<p>ClusterSSH opens a terminal window for each computer and using a master window you can run the same command on all the computers. This is typically used for administrating several computers that are almost identical.</p>
<p>GNU <b>parallel</b> runs the same (or different) commands with different arguments in parallel possibly using remote computers to help computing. If more than one computer is listed in <b>-S</b> GNU <b>parallel</b> may only use one of these (e.g. if there are 8 jobs to be run and one computer has 8 cores).</p>
<p>GNU <b>parallel</b> can be used as a poor-man's version of ClusterSSH:</p>
<p><b>parallel --nonall -S server-a,server-b do_stuff foo bar</b></p>
<h1 id="BUGS">BUGS</h1>
<h2 id="Quoting-of-newline">Quoting of newline</h2>
<p>Because of the way newline is quoted this will not work:</p>
<p>echo 1,2,3 | parallel -vkd, "echo 'a{}b'"</p>
<p>However, these will all work:</p>
<p>echo 1,2,3 | parallel -vkd, echo a{}b</p>
<p>echo 1,2,3 | parallel -vkd, "echo 'a'{}'b'"</p>
<p>echo 1,2,3 | parallel -vkd, "echo 'a'"{}"'b'"</p>
<h2 id="Speed">Speed</h2>
<h3 id="Startup">Startup</h3>
<p>GNU <b>parallel</b> is slow at starting up - around 250 ms the first time and 150 ms after that.</p>
<h3 id="Job-startup">Job startup</h3>
<p>Starting a job on the local machine takes around 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 <b>-X</b> which will make the overhead less significant. Or you can run multiple GNU <b>parallel</b>s as described in <b>EXAMPLE: Speeding up fast jobs</b>.</p>
<h3 id="SSH">SSH</h3>
<p>When using multiple computers GNU <b>parallel</b> opens <b>ssh</b> 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 <b>--sshloginfile</b> contains many hosts it may be slow.</p>
<p>If your jobs are short you may see that there are fewer jobs running on the remove systems than expected. This is due to time spent logging in and out. <b>-M</b> may help here.</p>
<h3 id="Disk-access">Disk access</h3>
<p>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.</p>
<p>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:</p>
<pre><code> sem --id diskio cat file | compute | sem --id diskio cat > file</code></pre>
<p>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:</p>
<pre><code> sem --id read cat file | compute | sem --id write cat > file</code></pre>
<p>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.</p>
<h2 id="nice-limits-command-length">--nice limits command length</h2>
<p>The current implementation of <b>--nice</b> is too pessimistic in the max allowed command length. It only uses a little more than half of what it could. This affects <b>-X</b> and <b>-m</b>. If this becomes a real problem for you file a bug-report.</p>
<h2 id="Aliases-and-functions-do-not-work">Aliases and functions do not work</h2>
<p>If you get:</p>
<p><b>Can't exec "<i>command</i>": No such file or directory</b></p>
<p>or:</p>
<p><b>open3: exec of by <i>command</i> failed</b></p>
<p>it may be because <i>command</i> is not known, but it could also be because <i>command</i> is an alias or a function. If it is a function you need to <b>export -f</b> the function first. An alias will, however, not work (see why http://www.perlmonks.org/index.pl?node_id=484296), so change your alias to a script.</p>
<h1 id="REPORTING-BUGS">REPORTING BUGS</h1>
<p>Report bugs to <bug-parallel@gnu.org> or https://savannah.gnu.org/bugs/?func=additem&group=parallel</p>
<p>Your bug report should always include:</p>
<ul>
<li><p>The error message you get (if any).</p>
</li>
<li><p>The complete output of <b>parallel --version</b>. If you are not running the latest released version you should specify why you believe the problem is not fixed in that version.</p>
</li>
<li><p>A complete example that others can run that shows the problem. This should preferably be small and simple. A combination of <b>yes</b>, <b>seq</b>, <b>cat</b>, <b>echo</b>, and <b>sleep</b> can reproduce most errors. If your example requires large files, see if you can make them by something like <b>seq 1000000</b> > <b>file</b> or <b>yes | head -n 10000000</b> > <b>file</b>. If your example requires remote execution, see if you can use <b>localhost</b> - maybe using another login.</p>
</li>
<li><p>The output of your example. If your problem is not easily reproduced by others, the output might help them figure out the problem.</p>
</li>
<li><p>Whether you have watched the intro videos (http://www.youtube.com/playlist?list=PL284C9FF2488BC6D1), walked through the tutorial (man parallel_tutorial), and read the EXAMPLE section in the man page (man parallel - search for EXAMPLE:).</p>
</li>
</ul>
<p>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: http://sourceforge.net/projects/virtualboximage/files/</p>
<p>Specifying the name of your distribution is not enough as you may have installed software that is not in the VirtualBox images.</p>
<p>If you cannot reproduce the error on any of the VirtualBox images above, you should assume the debugging will be done through you. That will put 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 less work for you if you can reproduce the error on a VirtualBox.</p>
<h1 id="AUTHOR">AUTHOR</h1>
<p>When using GNU <b>parallel</b> for a publication please cite:</p>
<p>O. Tange (2011): GNU Parallel - The Command-Line Power Tool, ;login: The USENIX Magazine, February 2011:42-47.</p>
<p>Alternatively you can get GNU Parallel without this requirement by paying 10000 EUR.</p>
<p>Copyright (C) 2007-10-18 Ole Tange, http://ole.tange.dk</p>
<p>Copyright (C) 2008,2009,2010 Ole Tange, http://ole.tange.dk</p>
<p>Copyright (C) 2010,2011,2012,2013,2014 Ole Tange, http://ole.tange.dk and Free Software Foundation, Inc.</p>
<p>Parts of the manual concerning <b>xargs</b> compatibility is inspired by the manual of <b>xargs</b> from GNU findutils 4.4.2.</p>
<h1 id="LICENSE">LICENSE</h1>
<p>Copyright (C) 2007,2008,2009,2010,2011,2012,2013 Free Software Foundation, Inc.</p>
<p>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.</p>
<p>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.</p>
<p>You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.</p>
<h2 id="Documentation-license-I">Documentation license I</h2>
<p>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 fdl.txt.</p>
<h2 id="Documentation-license-II">Documentation license II</h2>
<p>You are free:</p>
<dl>
<dt id="to-Share"><b>to Share</b></dt>
<dd>
<p>to copy, distribute and transmit the work</p>
</dd>
<dt id="to-Remix"><b>to Remix</b></dt>
<dd>
<p>to adapt the work</p>
</dd>
</dl>
<p>Under the following conditions:</p>
<dl>
<dt id="Attribution"><b>Attribution</b></dt>
<dd>
<p>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).</p>
</dd>
<dt id="Share-Alike"><b>Share Alike</b></dt>
<dd>
<p>If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license.</p>
</dd>
</dl>
<p>With the understanding that:</p>
<dl>
<dt id="Waiver"><b>Waiver</b></dt>
<dd>
<p>Any of the above conditions can be waived if you get permission from the copyright holder.</p>
</dd>
<dt id="Public-Domain"><b>Public Domain</b></dt>
<dd>
<p>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.</p>
</dd>
<dt id="Other-Rights"><b>Other Rights</b></dt>
<dd>
<p>In no way are any of the following rights affected by the license:</p>
<ul>
<li><p>Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations;</p>
</li>
<li><p>The author's moral rights;</p>
</li>
<li><p>Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights.</p>
</li>
</ul>
</dd>
</dl>
<dl>
<dt id="Notice"><b>Notice</b></dt>
<dd>
<p>For any reuse or distribution, you must make clear to others the license terms of this work.</p>
</dd>
</dl>
<p>A copy of the full license is included in the file as cc-by-sa.txt.</p>
<h1 id="DEPENDENCIES">DEPENDENCIES</h1>
<p>GNU <b>parallel</b> uses Perl, and the Perl modules Getopt::Long, IPC::Open3, Symbol, IO::File, POSIX, and File::Temp. For remote usage it also uses rsync with ssh.</p>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p><b>ssh</b>(1), <b>rsync</b>(1), <b>find</b>(1), <b>xargs</b>(1), <b>dirname</b>(1), <b>make</b>(1), <b>pexec</b>(1), <b>ppss</b>(1), <b>xjobs</b>(1), <b>prll</b>(1), <b>dxargs</b>(1), <b>mdm</b>(1)</p>
</body>
</html>
|