0

I want tar command to show progress somehow in the output as I am working with large files and to have some idea what is the status. but I can't use some of the popular tools like pv, because only default programs are allowed on the system.

So in tar documentation, I found this option:

--checkpoint-action=ttyout='%T\r'

and while this outputs the progress in terminal quite nicely, I want to store progress in file in case terminal gets disconnected. But tar in this case, since it uses ttyout, seems to direct its output in /dev/tty.

So my question is, is there a way to redirect /dev/tty into file? and without some fancy programs, but just default tools included in standard linux distributions.

Or another option is with echo

--checkpoint-action='echo=\a %T'

but that does not have the \r option to output just single line and overwrite it. At least I was not able to make it work with this syntax to modify echo into echo -ne.

So maybe you have some thoughts on this direction

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Alex B
  • 13
  • 4

1 Answers1

2

It seems like this should work:

tar -cvf archive.tar * | tee filename.log

Or maybe you want something more like this?

tar --checkpoint --checkpoint-action='exec=echo $TAR_CHECKPOINT > filename.log ' --checkpoint-action='ttyout=%u\r' -cf archive.tar *
Tom Bascom
  • 13,405
  • 2
  • 27
  • 33