Update cheatsheets

This commit is contained in:
ivuorinen
2024-02-21 11:19:49 +00:00
parent 4e88a1b42f
commit 3d653cc7e6
4803 changed files with 127002 additions and 0 deletions

41
parallel Normal file
View File

@@ -0,0 +1,41 @@
---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# parallel
> Run commands on multiple CPU cores.
> More information: <https://www.gnu.org/software/parallel>.
- Gzip several files at once, using all cores:
`parallel gzip ::: {{path/to/file1 path/to/file2 ...}}`
- Read arguments from `stdin`, run 4 jobs at once:
`ls *.txt | parallel -j4 gzip`
- Convert JPG images to PNG using replacement strings:
`parallel convert {} {.}.png ::: *.jpg`
- Parallel xargs, cram as many args as possible onto one command:
`{{args}} | parallel -X {{command}}`
- Break `stdin` into ~1M blocks, feed each block to `stdin` of new command:
`cat {{big_file.txt}} | parallel --pipe --block 1M {{command}}`
- Run on multiple machines via SSH:
`parallel -S {{machine1}},{{machine2}} {{command}} ::: {{arg1}} {{arg2}}`
- Download 4 files simultaneously from a text file containing links showing progress:
`parallel -j4 --bar --eta wget -q {} :::: {{path/to/links.txt}}`
- Print the jobs which `parallel` is running in `stderr`:
`parallel -t {{command}} ::: {{args}}`