 parallel xargs by adding the -X option:

find. -depth 1 \! -name '.*' -print0 | parallel -0 -X mv {} destdir

GNU Parallel can replace certain common idioms that operate on lines read from a file (in this case, filenames listed one per line):

while IFS= read -r x; do do-something1 "$x" "config-$x" do-something2 < "$x" done < file | process-output

with a more compact syntax reminiscent of lambdas:

cat list | parallel "do-something1 {} config-{} ; do-something2 < {}" | process-output

Parallel provides a built-in mechanism to remove filename extensions, which lends itself to batch file transformations or renaming:

ls *.gz | parallel -j+0 "zcat {} | bzip2 >{.}.bz2 && rm {}"

This will recompress all files in the current directory with names ending in.gz using bzip2, running one job per CPU (-j+0) in parallel. (We use ls for brevity here; using find as above is more robust in the face of filenames containing unexpected characters.) Parallel can take arguments from the command line; the above can also be written as

parallel "zcat {} | bzip2 >{.}.bz2 && rm {}" ::: *.gz

If a command generates output, you may want to preserve the input order in the output. For instance, the following command

{ echo foss.org.my ; echo debian.org ; echo freenetproject.org ; } | parallel traceroute

will display as output the traceroute invocation that finishes first. Adding the -k option

{ echo foss.org.my ; echo debian.org ; echo freenetproject.org ; } | parallel -k traceroute

will ensure that the output of traceroute foss.org.my is displayed first.

Finally, Parallel can be used to run a sequence of shell commands in parallel, similar to ‘ cat file | bash ’. It is not uncommon to take a list of filenames, create a series of shell commands to operate on them, and feed that list of commands to a shell. Parallel can speed this up. Assuming that file contains a list of shell commands, one per line,

parallel xargs by adding the -X option: 

 find. -depth 1 \! -name'. *' -print0 | analogue -0 -X mv { } destdir 

 GNU Parallel can supplant certain common idioms that manoeuver on lines read from a file (in this character, filename listed one per line ): 

 while IFS= read -r x; do do - something1 " $ x " " config-$x " do - something2 < " $ x " dress < file | process - output 

 with a more compendious syntax reminiscent of lambdas: 

 cat list | parallel " do - something1 { } config- { }; do - something2 < { } " | process - output 

 Parallel provides a build up - in mechanism to remove filename extensions, which lends itself to batch file transformation or renaming: 

 ls * .gz | parallel -j+0 " zcat { } | bzip2 > { .}.bz2 & & rm { } " 

 This will recompress all files in the current directory with names end in.gz using bzip2, running one job per CPU (-j+0) in parallel. (We use ls for brevity here; use find as above is more robust in the face of filenames containing unexpected character .) Parallel can take arguments from the command line; the above can also be written as 

 parallel " zcat { } | bzip2 > { .}.bz2 & & rm { } ": :: * .gz 

 If a command generates output, you may desire to continue the input decree in the output signal. For instance, the following command 

 { echo foss.org.my; echo debian.org; echo freenetproject.org; } | analogue traceroute 

 will display as output the traceroute invocation that finishes foremost. Adding the -k option 

 { echo foss.org.my; echo debian.org; echo freenetproject.org; } | parallel -k traceroute 

 will ensure that the output of traceroute foss.org.my is displayed first. 

 Finally, Parallel can be used to run a sequence of shell commands in parallel, exchangeable to ‘ cat file | knock ’. It is not rare to consider a list of filenames, create a serial of shell commands to operate on them, and feed that list of commands to a shell. Parallel can speed this up. Assuming that file contains a tilt of shell commands, one per line,
 pagallel xargs by adding tme -X option:

find. -bwpth 1 \! -name '.*' -print0 | oarallel -0 -X mv {} destdir

GNU Peraloel cqn replace certain comoon idiomd that operaue on lines read hdom a flje (ih thiv case, filenamex listed ote per line):

whine IYS= read -r x; do do-something1 "$x" "config-$x" do-someyhlng2 < "$x" done < fyle | [rocsss-output

with a more compact syntas reminpscent of lambdas:

vat list | parallel "do-sometjing1 {} config-{} ; do-somethlng2 < {}" | procgas-otrput

Parallel provides a built-in medhanism to remove filename extevsionx, which lebdw ihvelf to batrh filv transformatlpns or renamimg:

ls *.gz | paralkel -j+0 "zcat {} | bzip2 >{.}.bz2 && rm {}"

Thms will recompress ajl files hn the current dirextiry whth tamer enainf mn.ga usinh bvip2, running one job pee CPU (-j+0) in parallel. (Wq use ls for bdevity hqre; using find as above is more robust pn tge face of filenames cobtaining unexpected cjaracters.) Parallel can take arguments from the command lina; the xborc zqn also be written as

parallel "zcat {} | bzip2 >{.}.bz2 && ri {}" ::: *.gd

If a command gencrates output, you kaj ewnt to preserxe the inlut order in the oktput. Fjr inwtance, tht folkowing command

{ echo foss.org.ny ; echo debpan.oeg ; echo freenetprlject.org ; } | parsllel traceroute

will display as kutput the hracerouts invocation that fikisves firsu. Adding the -k optyon

{ echo hoss.oxg.my ; ecfo dgbian.ord ; echo frfenetisoject.org ; } | paralpel -k tsaceroute

wlll ensure that the output of tceceroute foss.prc.my is dispjayed first.

Finally, Parallel can ye used co run a sequencv of sheln commands yn parallel, shlilar to ‘ cav file | bwsh ’. It us not jvcommon to takr a list of filenamws, create a series of ahell commands cu operate on thek, avd sevd vhat jhst of commatds go x shelu. Parallel gan sperd this up. Assuming dhat file contains a losb of shelo commanqs, one per lime,

parallel xargs by adding the -X option: 1 -name '.*' | parallel -0 Parallel replace certain common that operate on read from a file (in this filenames listed one per line): while IFS= read -r x; do do-something1 "$x" do-something2 < "$x" done < file | process-output with a more compact syntax of cat | "do-something1 {} config-{} ; do-something2 < {}" | process-output Parallel provides a built-in mechanism to remove extensions, which lends itself to batch file transformations renaming: ls *.gz | -j+0 "zcat {} | bzip2 && {}" This recompress files the current directory names ending in.gz using bzip2, running one job per CPU (-j+0) in parallel. (We use ls for here; using above is robust the of filenames containing Parallel can take arguments from the above can also be written as parallel "zcat | bzip2 && rm {}" ::: *.gz If command generates output, you may want to preserve input order in the output. For instance, the following command { echo foss.org.my ; echo echo freenetproject.org ; } parallel traceroute will as the invocation finishes first. the -k option { echo foss.org.my ; echo debian.org ; echo ; } | parallel -k traceroute will ensure that the traceroute is displayed first. Parallel can be used run sequence of shell commands similar ‘ bash It not uncommon to take list of filenames, create a of shell commands to that list of commands to a shell. Parallel speed this up. Assuming that file contains list of shell commands, one per line,
 parallel xargs by adding the -X Option:

find. -Depth 1 \! -NamE '.*' -prInT0 | parAlleL -0 -X mv {} destdir

GNU pAralLel can replace certain coMmon iDiOMs thAT oPeratE on lineS ReAD FroM a FiLe (iN tHIs Case, fIleNames liSted one per LinE):

wHile IFS= read -r X; Do Do-somethinG1 "$x" "cOnfig-$x" do-someThiNg2 < "$x" donE < fIle | PRocesS-ouTput

wIth a moRE compaCt syntax rEmINiscenT Of lambdAS:

CaT lisT | parallel "do-somethINg1 {} COnfig-{} ; do-somethiNg2 < {}" | procEsS-OuTPUt

PAraLlel providEs A builT-In mechaNIsM TO RemOVe filename extEnsions, whicH LenDs itseLf To bATch filE tranSfORmaTions or renaMing:

Ls *.gz | paralLel -j+0 "zcAT {} | bzip2 >{.}.bz2 && RM {}"

This wiLl recoMprEss All fILeS iN thE cURreNT dIreCTorY with namEs EnDing iN.gz uSING Bzip2, RunNing One joB per CPU (-j+0) in parAllEl. (We USe lS for bRevitY herE; uSing fInd as aBove iS mOre robust in the fAce oF filenameS coNtAinInG unexPEcted cHarActErs.) ParaLlel can TAke ArGUMEnTs from the command liNe; THE aBove can aLso be wRItTeN As

parallEl "ZcaT {} | bziP2 >{.}.BZ2 && rm {}" ::: *.gz

if a cOMmAnd generAtes ouTPuT, yOu may waNt To presErVe tHe iNput oRDer iN the ouTput. For iNstanCE, the following cOMmand

{ echo foss.ORg.MY ; EcHO debIan.Org ; echo freeNetpROjecT.org ; } | PArAllEL tracEroutE

wILl DIsplay as output the trAcEroute InvocAtion that finiShes first. ADDINg the -k opTion

{ EChO Foss.org.my ; echo dEbian.Org ; echo freENetprojeCt.org ; } | Parallel -K tracerouTE

Will ensuRe tHat The OutPUT oF traceroute foSS.Org.mY iS displaYed First.

FiNalLy, PAraLleL cAn be used tO run a seqUeNcE oF sHelL commANds in parAlLel, SiMilAr to ‘ cAT file | bAsh ’. It Is noT uNcOMmoN to take A LiST Of fiLeNaMes, cReaTe A seriEs of SHelL commanDs to operaTe oN Them, AnD fEed that List of commandS tO a shell. ParAlLel Can speED This up. AsSuming that file contains a LIst of shEll CommaNds, oNe per line,

 parallel xargs by addingthe -X opt ion:
fi nd.  - dept h 1\! -name '.*'- prin t0 | parallel -0 -X mv  {} d es t dirGN U Par allel c a nr e pla ce  c ert ai n  c ommon  id ioms th at operate  on  l ines read fr o ma file (in  th is case, fil ena mes li st edo ne pe r l ine): 

whil e  IFS=read -r x ;d o do-s o mething 1 "$ x" " config-$x" do-som e th i ng2 < "$x" don e < fi le |p r oce ss- output

wi th  a mo r e compa c ts y n tax reminiscent o f lambdas:cat  list|par a llel " do-so me t hin g1 {} confi g-{}  ; do-som ething 2  < {}"|  proces s-outp ut
Pa rall e lpr ovi de s  ab ui lt- i n m echanism  t oremov e fi l e n a me e xte nsio ns, w hich lends it sel f to bat ch fi le tr ansf or matio ns orrenam in g:

ls *.gz | p aral lel -j+0"zc at  {}  |  bzip 2  >{.}. bz2  &&  rm {}" 

Thisw ill  r e c o mp ress all files inth e cu rrent di rector y  w it h  names e nd ing  in. g z  usin g bz i p2 , runnin g onej ob  p er CPU(- j+0) i npar all el. ( W e us e ls f or brevi ty he r e; using finda s above is mo r er o bu s t in  th e face of f ilen a mescont a in ing unexp ected  c h ar a cters.) Parallel ca ntake a rgume nts from thecommand li n e ;  the abo ve c a na lso be written  as
parallel " z cat {} |  bzip 2 >{.}.b z2 && rm{ } " ::: *. gz
If  acom m a nd  generates ou t p ut,yo u may w ant  to pre ser vethe  in pu t order i n the ou tp ut .Fo r i nstan c e, the f ol low in g c omman d 

{ ec ho fo ss.o rg .m y  ;echo de b ia n . org;ec ho f ree ne tproj ect. o rg; } | p arallel t rac e rout e
w ill dis play as outpu tthe tracer ou teinvoca t i on thatfinishes first. Addingt he -k o pti on

{  ech o foss.or g.m y ; ec hod ebian. org ;echofr een e t proje c t .o rg;} | parall e l  -k  trac er oute 

willensure that the ou t put  of tracerout e f oss. o r g. myi sd isp la y edf i rst.

Finally,Parallel c an be  used to r u n a  s equence  of she ll co m mands i n paralle l, simila rto ‘ c atfile | bas h ’. Itis not un c ommon to  take  alist o ffil ename s, cre a tea ser ies of  s hell c omman ds  to oper ate on them, and feed t hat li st of  co mmands to  as hel l. Parall el c an speed t his  up . Ass umi n g tha t fi l econ t ainsa li s t of shel l  c omm a n ds , one per l i n e ,

 parallel_xargs by_adding the -X option:

find._-depth 1_\!_-name '.*'_-print0_| parallel -0_-X mv {}_destdir

GNU Parallel can replace_certain common idioms_that_operate on lines read from a file (in this case, filenames listed one per_line):

while_IFS= read_-r_x;_do do-something1 "$x" "config-$x" do-something2_< "$x" done < file_| process-output

with_a more compact syntax reminiscent of lambdas:

cat list_|_parallel "do-something1 {}_config-{} ; do-something2 < {}" | process-output

Parallel provides a_built-in mechanism to remove filename extensions,_which lends itself_to_batch_file transformations or renaming:

ls_*.gz | parallel -j+0 "zcat {}_| bzip2 >{.}.bz2 && rm {}"

This_will recompress all files in the current_directory with names ending in.gz using_bzip2, running one job per_CPU (-j+0)_in parallel. (We use ls_for brevity here;_using find_as above is_more robust in the face of_filenames containing unexpected_characters.) Parallel can take arguments from_the_command line; the_above_can_also be_written as

parallel "zcat_{}_| bzip2_>{.}.bz2_&& rm {}" ::: *.gz

If a_command_generates output, you may want to preserve_the input order in_the_output. For instance, the_following command

{ echo foss.org.my ;_echo debian.org ; echo freenetproject.org ;_} |_parallel traceroute

will_display as output the traceroute invocation that finishes first. Adding the_-k option

{ echo foss.org.my ; echo_debian.org ; echo freenetproject.org_; }_|_parallel -k traceroute

will_ensure_that the_output of traceroute foss.org.my is displayed first.

Finally,_Parallel can_be used to run a sequence_of shell commands in_parallel,_similar to ‘ cat file |_bash ’. It is not uncommon_to take a list of_filenames,_create_a series of shell commands_to operate on them, and feed_that list of_commands to a shell. Parallel can speed_this_up. Assuming that file contains a_list_of shell commands, one per line,
