1

I have a problem with extracting files with a progress bar. It always gives me an error:

pv "file.tar.xz" | tar -xf

tar: need argument -- f
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
heavyblack1
  • 72
  • 2
  • 9

2 Answers2

3

this work for me: pv "file.tar.gz" | tar -xzf - -C target_directory

Daniel Bentes
  • 508
  • 4
  • 10
2

The -f option requires the archive to operate on as an argument, see man tar(1).
Use - to extract from stdin (provided by the pipe pv "file.tar.xz" | in your case):

pv "file.tar.xz" | tar -xJf-

As - is usually the compiled-in default archive (you can probably check with tar --show-defaults), you might be able to omit the -f option altogether and simply use

pv "file.tar.xz" | tar -xJ
Manfred
  • 2,269
  • 1
  • 5
  • 14