tarpv

Extract .tar.xz with pv progress bar


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

Solution

  • 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