Skip to content
Run similar commands concurrently
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

What is Par?

Have you ever want to run a bunch of related processes at once, and maybe even collect their output? If so, this little thing is for you. Par spins up a fleet of goroutines and runs a command template you specify against standard input. It's best suited for tasks where you would expect concurrency to help you out -- things where network timeouts are possible and can slow your processing time down to a crawl.


On OS X:

$ brew install go
$ echo PATH=$PATH:`brew --prefix go`/bin >> ~/.bash_profile && source ~/.bash_profile
$ go get


Webscaling your family

$ cat family.txt
$ par "echo hello %line" < family.txt
Running with 8 workers
[echo hello Mai] starting
[echo hello Mai] hello Mai
[echo hello Mai] finished
[echo hello Kelly] starting
[echo hello Kelly] hello Kelly
[echo hello Kelly] finished
[echo hello Jon] starting
[echo hello Jon] hello Jon
[echo hello Jon] finished
[echo hello Tommy] starting
[echo hello Tommy] hello Tommy
[echo hello Tommy] finished

Find the IP address of every dictionary word .com domain

$ par "dig +short" < /usr/share/dict/words
Running with 8 workers
[dig +short] starting
[dig +short]
[dig +short] finished
[dig +short] starting
[dig +short]
[dig +short] finished
[dig +short] starting
[dig +short]
[dig +short] finished

Mirroring a backup to a bunch of geographically dispersed servers

$ par "scp backup.dump jroes@%line:backups/" < ~/.backup_servers
Running with 8 workers
[scp backup.dump] starting
[scp backup.dump] finished
[scp backup.dump] starting
[scp backup.dump] finished
You can’t perform that action at this time.