Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tqdm: add examples #15751

Merged
merged 10 commits into from
Apr 6, 2025
Merged
16 changes: 14 additions & 2 deletions pages/common/tqdm.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# tqdm

> Create a progress bar.
> Show progress over time of a command.
> More information: <https://tqdm.github.io/>.

- Show iterations per second and use `stdout` afterwards:

`{{seq 10000000}} | tqdm | {{command}}`

- Create a progress bar:

`seq 10000000 | tqdm --total 10000000 --null`
`{{seq 10000000}} | tqdm --total {{10000000}} | {{command}}`

- Create an archive out of a directory and use the file count of that directory to create a progress bar:

`zip -r {{path/to/archive.zip}} {{path/to/directory}} | tqdm --total $(find {{path/to/directory}} | wc -l) --unit files --null`

- Create an archive with tar and create a progress bar (system agnostic, GNU tar uses `stdout` while BSD tar uses `stderr`):

`tar vzcf {{path/to/archive.tar.gz}} {{path/to/directory}} 2>&1 | tqdm --total $(find {{path/to/directory}} | wc -l) --unit files --null`