🖥️parallel

➡️This is a command-line reference manual for commands and command combinations that you don’t use often enough to remember it. This cheatsheet explains the parallel command with important options and switches using examples.

▁ ▂ ▃ ▄ ꧁ 🔴☠ COMMANDLINE-KUNGFU WITH CHEATSHEETS ☠🔴꧂▅ ▃ ▂ ▁

#                ██████╗  █████╗ ██████╗  █████╗ ██╗     ██╗     ███████╗██╗     
#                ██╔══██╗██╔══██╗██╔══██╗██╔══██╗██║     ██║     ██╔════╝██║     
#                ██████╔╝███████║██████╔╝███████║██║     ██║     █████╗  ██║     
#                ██╔═══╝ ██╔══██║██╔══██╗██╔══██║██║     ██║     ██╔══╝  ██║     
#                ██║     ██║  ██║██║  ██║██║  ██║███████╗███████╗███████╗███████╗
#                ╚═╝     ╚═╝  ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝╚══════╝╚══════╝
                                                                                
                                                                                
                                                                                

parallel --tag echo '$(du -s {} | awk "{print \$1}") / $(find {} | wc -l)' \| bc -l ::: *
# Compute the average number of KB per file for each dir -> Shorter version using --tag

# Parallel Apache Benchmark -> (echo "https://example.com/"; echo "https://example.com/"; echo "https://example.com/"; echo "https://example.com/") | parallel -k 'ab -n 10000 -c 15 {}'
cat url_list.txt | parallel -k 'ab -n 10000 -c 15 {}'

# Converts all pngs in a folder to webp using all available cores
# As an alternative to the above command, this one ditches the unnecessary and complicated for loop in favor of a way faster multi-core approach for a task that's more CPU than I/O intensive, making it a perfect suite for GNU parallel
parallel cwebp -q 80 {} -o {.}.webp ::: *.png

# Clock
parallel -q convert -size 300x300 xc:black -stroke green -draw '{= sub l{ ($r,$v)=@_; $v*=atan2(1,0)*4/360; "line 150,150 ".int(150-$r*sin($v)).",".int(150+$r*cos($v)).";"} $_=l(25,$_/2+180).l(50,$_%60*6+180) =}' C{}.gif ::: {000..720}; convert C*gif clock.gif

# Tweetsized colorized
parallel eval convert -size 300x300 xc:black '{=sub l{($c,$r,$v)=@_;$v*=atan2(1,0);"-stroke $c -draw \"line 150,150 ".(150-$r*sin$v).",".(150+$r*cos$v).";\" "}$_=l("red",50,$_/180+2).l("green",100,$_%60/15+2)=}' C{}.gif ::: {000..719};convert C*gif clock.gif

# Shorter, faster radar (does not require numround)
parallel -q convert -size 300x300 xc:black -stroke green -draw 'line 150,150 {= $_*=atan2(1,0)*4/360; $r=50; $_=int(150-$r*sin($_)).",".int(150+$r*cos($_)) =}' R{}.gif ::: {180..540}; convert R*gif radar.gif

# Fast portscanner via Parallel
parallel -j200% -n1 -a textfile-with-hosts.txt nc -vz {} ::: 22

#==============================##==============================#
# CMD PARALLEL						       #
#==============================##==============================#
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░

  █║▌│║█║▌★ KALI ★ PARROT ★ DEBIAN 🔴 PENTESTING ★ HACKING ★ █║▌│║█║▌

              ██╗ ██╗ ██████╗  ██████╗ ██╗  ██╗███████╗██████╗
             ████████╗██╔══██╗██╔═══██╗╚██╗██╔╝██╔════╝██╔══██╗
             ╚██╔═██╔╝██║  ██║██║   ██║ ╚███╔╝ █████╗  ██║  ██║
             ████████╗██║  ██║██║   ██║ ██╔██╗ ██╔══╝  ██║  ██║
             ╚██╔═██╔╝██████╔╝╚██████╔╝██╔╝ ██╗███████╗██████╔╝
              ╚═╝ ╚═╝ ╚═════╝  ╚═════╝ ╚═╝  ╚═╝╚══════╝╚═════╝

               █║▌│║█║▌ WITH COMMANDLINE-KUNGFU POWER █║▌│║█║▌

░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░