how can i properly display the curl progress in the dialog window?

curl http://mysite.corp/image/root_21.tar.bz2 | tar -C /mnt/dest/ -jxf -

enter image description here

i tried this command but as you can see it does not display it correctly.

curl -f -x '' -L http://mysite.corp/image/root_21.tar.bz2 | tar -C /mnt/dest -xjpf - --exclude='dev/*' | dialog --backtitle "dialog" --stderr --title 'Linux Image' --textbox /tmp/log 30 80

enter image description here

this command almost helps me but i want it to overwrite itself and not show me new line progress in each line. basically i want it to be the same as the original command shows it but in the dialog.

(curl -f -x '' -L http://mysite.corp/image/root_21.tar.bz2  | tar -C /mnt/dest -xjpf - --exclude='dev/*' ) 2>&1 | dialog  --progressbox 20 120

enter image description here


You can use the --progressbox option of dialog like

(curl ... | tar ... ) 2>&1 | dialog --progressbox 30 120

2>&1 redirects the stderr output of curl and tar to the stdin, i.e. the pipe to dialog.

The rewriting of lines (control char: CR '\r' (carriage return)) is not supported by dialog therefore you get each progress change in an extra line.

  • almost . i get the output ok now but every progress shows on a new line. in some point it push the title up so i cant see it. i need it to overwrite itself with the new line progress and not show me new line on each progress. basically i need the output the exactly as the original command will show it. – Asaf Magen Sep 7 '15 at 13:29
  • @AsafMagen I extended my answer, the feature you want is not implemented in dialog. Basically this is a new question how to get this (you probably need to rewrite/emulate dialog). – jofel Sep 7 '15 at 14:26
  • ok thanks you for explaining. i hope maybe someone will supply some sort of a workaround if there is any... – Asaf Magen Sep 7 '15 at 14:37

When downloading with curl and redirecting to tar, a simple progress can be printed with:

--checkpoint[=NUMBER] display progress messages every NUMBERth record

--checkpoint-action=ACTION execute ACTION on each checkpoint

For example, this will download and extract gz file, while printing dot every 10 check-points:

curl -s -L $url | tar -xz --checkpoint=.10

To see more details during progress:

  • Remove the "-s" from the curl command, if you don't want curl to have "silent" output.
  • Add "-v" to the tar command, to print list of files being extracted from the archive.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.